问题
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 Goal - clean install
Does it need any special maven goal to get things copied ? Please help me out here.
plugin version -2.6
Refering this
回答1:
The issue was wrong phase and multiple maven-resource-plugin entries.
Below code worked for me.
<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>
来源:https://stackoverflow.com/questions/55880013/copy-resource-not-working-in-maven-resource-plugin