springboot 和 war的相关处理网上有很多,这里就不再赘述了。本文只介绍单纯的简单maven项目如何打包scope为system的jar包依赖。
以tools.jar举例:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8</version>
</dependency>
<build>
<plugins>
<!-- 这里要加入其它的plugin,比如打包的,编译的等 -->
<!-- 下面是关键所在,将原本只能写为scopey为system的jar包,变为非system,从而可以打入到jar包中-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${java.home}/../lib/tools.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>