1 回答

TA贡献1813条经验 获得超2个赞
无法弄清楚Ant,所以我使用了这个答案。就我而言,它看起来像这样:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/WEB-INF</outputDirectory>
<resources>
<resource>
<directory>target/testproject-1.0-SNAPSHOT/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
编辑:这个插件复制一个一个地粘贴文件,而不是使用一个文件夹并将其与所有文件一起复制粘贴一次。这会导致类和目录之间的链接断开,并且似乎没有任何效果。现在,我正在使用batch脚本:
xcopy "C:\...\Tomcat 8.5\webapps\TestArt\target\testproject-1.0-SNAPSHOT\WEB-INF" "C:\...\Tomcat 8.5\webapps\TestArt\WEB-INF\" /E /Y
使用这个答案的Maven 插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<exec executable="${basedir}\copy.bat">
</exec>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
我设法达到了预期的结果。
但是,如果纯 Maven 中有可以一次性复制目录的解决方案,我很想听听。
添加回答
举报