1、首先设置依赖项,这样maven就会把该路径下的jar包导入项目引用
<dependency>
<groupId>DPSDK-Manager</groupId>
<artifactId>DPSDK-Manager</artifactId>
<version>0.2.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/DPSDK-Manager-0.2.1.jar</systemPath>
</dependency>
设置好后会发现library下面,maven dependencies中已经出现本地jar包了,这样就可以在项目中调用本地jar包了
2、设置maven-war-plugin打包插件,让maven在导出war包时把设置好的路径下的文件打进war包
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${project.basedir}/libs</directory>
<targetPath>WEB-INF/libs</targetPath>
<filtering>true</filtering>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
设置好后再执行mvn clean package命令就会将指定路径下的文件打进war包