当maven项目中使用<systemPath>标签时,打包项目时会报警告,具体如下所示:
为了解决这个warning,使用如下maven插件:
<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>${basedir}/lib/mylib-core-0.0.1.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.mylib</groupId>
<artifactId>mylib-core</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
当打包maven项目时,首先运行 mvn clean 命令,再运行 mvn package 命令,即可生成jar包。
其中,插件的最新版本请到下面的网站查询:
maven-install-plugin:https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin
参考文献:https://stackoverflow.com/questions/10935135/maven-and-adding-jars-to-system-scope