复制资源在Maven资源插件中不起作用 [英] copy-resource not working in maven resource plugin
本文介绍了复制资源在Maven资源插件中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Maven资源插件在构建时复制xml文件,但到目前为止没有成功.
I am trying to copy an xml file at build time using maven resource plugin with no success till now.
<profile>
.
.
<build>
.
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
.
.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/Test</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/target/common-aws</directory>
<filtering>true</filtering>
<includes>
<include>*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugins>
.
.
</build>
.
.
</profile>
Maven目标-全新安装
Maven Goal - clean install
是否需要任何特殊的Maven目标来复制内容? 请在这里帮助我.
Does it need any special maven goal to get things copied ? Please help me out here.
插件版本-2.6
推荐答案
阶段出现了问题,并且有多个maven-resource-plugin条目.
The issue was wrong phase and multiple maven-resource-plugin entries.
下面的代码对我有用.
<execution>
<id>copy-resources3</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/somedirectory</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/target/common-aws</directory>
<includes>
<include>*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
这篇关于复制资源在Maven资源插件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文