使用maven-install-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
实例:
在maven工程根目录新建lib文件夹,里头有个demo.jar纳入管理
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>install-demo-jar</id>
<phase>clean</phase>
<configuration>
<repositoryLayout>default</repositoryLayout>
<groupId>com.example</groupId>
<artifactId>demojar</artifactId>
<version>1.0.0</version>
<file>${project.basedir}/lib/demo.jar</file>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
安装
mvn clean install(eclipse clean)
添加依赖
<dependency>
<groupId>com.example</groupId>
<artifactId>demojar</artifactId>
<version>1.0.0</version>
</dependency>
这样就大功告成了,可以打成fat jar