I'm trying to use the maven-resources-plugin to do some filtering using the copy-resources goal, and ran into the following error:
Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources (default-cli) on project bar: The parameters 'resources', 'outputDirectory' for goal org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources are missing or invalid
To isolate the problem, I created a very simple pom.xml, copied pretty nearly verbatim from http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html, ran it, and got the same error.
I'm invoking it with
mvn resources:copy-resources
Any ideas? Here's the test pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/extra-resources</outputDirectory>
<resources>
<resource>
<directory>src/non-packaged-resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The main problem you had is that you are invoking the plugin goal directly using
which does not necessarily create the output directory. Instead call the correct Maven lifecycle phase.
For a complete list of the lifecycle phases just run the mvn command without anything..
In general it almost always better to invoke a lifecycle phase rather than a goal directly since it guarantees that any preconditions are met (e.g. cant compile test classes before the classes to be tested..).