Maven打包会使用Maven仓库,本地的Jar并不会打入War包中,那么这种情况要如何解决呢?
创建本地包目录
在项目根目录中创建lib目录用于存放本地Jar包
POM.XML修改
添加本地Jar包
<dependency>
<groupId>人工马赛克</groupId>
<artifactId>人工马赛克</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/人工马赛克.jar</systemPath>
</dependency>
<dependency>
<groupId>人工马赛克</groupId>
<artifactId>人工马赛克</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/人工马赛克.jar</systemPath>
</dependency>
在plugins中加入如下:
<build>
<plugins>
<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>
</plugins>
</build>