pom文件里面依赖的jar包会在打包时拷贝到WEB-INF/lib目录下,但有时我们使用的jar包不都是maven构件,那么如何将这些第三方jar包打包进war包,解决这个问题我们可以通过maven-war-plugin这个maven插件,具体可进行如下配置:
代码语言:javascript复制<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<warName>${project.artifactId}</warName>
<webResources>
<resource>
<directory>src/main/lib/(设置成第三档jar包目录)</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>