【发布时间】:2014-10-21 19:27:54
【问题描述】:
我有 maven prj 和 2 个模块:一个 JAR 和一个依赖于 JAR 的 WAR。
在 MAVEN INSTALL 之后,我将包含所有 jar 依赖项(包括第一个模块的 JAR)的经典 WEB-INF/lib 文件夹放入 WAR 中。
我需要将第一个模块的 JAR 移动到另一个文件夹,例如 WEB-INF/resources。 如我所能?
我能够移动罐子,但只能在目标内移动,WAR 保持不变。 我使用了以下插件:
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>copy-installed</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>1.0</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/.../WEB-INF/services</outputDirectory>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/.../WEB-INF/services</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
【问题讨论】:
-
我认为您必须为此创建新模块,并且在执行 mvn-clean 安装时,您可以将任何文件移动到任何目录。
标签: java maven jar war maven-plugin