Maven引入本地Jar包并将其打包进War包中

配置pom.xml,依赖本地Jar

1
2
3
4
5
6
7
<dependency>
<groupId>alipay</groupId>
<artifactId>alipay-sdk</artifactId>
<version>20170411150054</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/libs/alipay-sdk-java20170411150054.jar</systemPath>
</dependency>

配置Maven插件将本地Jar打包进War中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
<includeScope>system</includeScope>
</configuration>
</execution>
</executions>
</plugin>