when I create a war package with maven, files and directories under the directory "src/main/resources" are copied in /WEB-INF/classes instead of /WEB-INF. How can I get them copied in /WEB-INF?
thanks, rand
UPDATE: in my pom now I use this:
<plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>war</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>myapp/target/WEB-INF</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin>
and I launch mvn with:
mvn -Dmaven.test.skip=true clean package resources:copy-resources
but I got:
[INFO] One or more required plugin parameters are invalid/missing for 'resources:copy-resources' [0] Inside the definition for plugin 'maven-resources-plugin' specify the following: <configuration> ... <outputDirectory>VALUE</outputDirectory> </configuration>. [1] Inside the definition for plugin 'maven-resources-plugin' specify the following: <configuration> ... <resources>VALUE</resources> </configuration>.
I'm using maven 2.2 and the snippet basically is the same of the documentation any idea?
Using the mvn:war:exploded command, we can generate the exploded WAR as a directory inside the target directory. This is a normal directory, and all the files inside the WAR file are contained inside the exploded WAR directory.
either configure the outputDirectory
parameter of resources:resources
plugin, or put your files under src/main/webapp/WEB-INF/
directory. resource plugin
EDIT:
This configuration is working for me:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.2</version> <executions> <execution> <id>default-copy-resources</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/</outputDirectory> <resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> </resources> </configuration> </execution> </executions> </plugin>
you can run a phase in the form somePhase
or a goal somePlugin:someGoal
. The phase invocations will invoke all plugins goals hooked on phases in interval [validate,phase] in order, so there's no need to explicitly call them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With