Reputation: 51
I need to use maven to copy some files. Here is what my folder structure looks like: `
+code
+trunk
+delivery
-pom.xml
+myFramework
+catalog
-pom.xml
+target
+classes
-catalog.properties
-catalog.xml
+orders
-pom.xml
+target
+classes
-orders.properties
-orders.xml
+common
-pom.xml
+target
+classes
-common.properties
-common.xml
-pom.xml
+myOther
+stuff
+moreStuff
+target
+classes
-moreStuff.properties
-pom.xml
-pom.xml
-pom.xml
+Test
-pom.xml
+distros
+dome`
The plusses(+) are directories and the minuses(-) are files.
I have to make changes to the pom.xml in the delivery folder. What needs to happen is that the properties and xml files from the catalog, orders, common, and moreStuff folders need to get copied to the dome folder.
So the end result after the delivery pom is executed is that the dome directory contains catalog.properties, catalog.xml, orders.properties, orders.xml, common.properties, common.xml, and moreStuff.properties.
Upvotes: 1
Views: 784
Reputation: 51
I made changes to the root pom (under trunk) and not the delivery pom. This is how I ended up doing this:
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>C:/distros/dome</outputDirectory>
<resources>
<resource>
<directory>src\main\resources</directory>
<excludes>
<exclude> ... </exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Instead of copying them from the target/classes folders, I ended up copying the resource files from the src/main/resources folders (not indicated in the original question).
Upvotes: 1