<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
其中
<outputDirectory>${project.build.directory}/locallib</outputDirectory>
就是指定war或jar所依赖的lib包存放目录,与所打的war或jar在同一级目录
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
其中
<outputDirectory>${project.build.directory}/locallib</outputDirectory>
就是指定war或jar所依赖的lib包存放目录,与所打的war或jar在同一级目录
本文介绍了一种使用Maven依赖插件将项目依赖项复制到指定目录的方法。具体配置包括设置输出目录、覆盖策略等,确保了WAR或JAR文件与其依赖的LIB包在同一层级。
662

被折叠的 条评论
为什么被折叠?



