maven-dependency-plugin:copy tries to copy classes
I have parent pom and two module poms. In first module I want to copy second module (jar) to some folder. When I compiling project from first module pom - it works, but when I'm trying to compile from parent project pom, plugin tries to copy module classes insted of jar:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:copy (default) on project module1: Error copying artifact from /home/chardex/projects/test/module2/target/classes to /home/chardex/projects/test/module1/target/lib/classes: /home/chardex/projects/test/module2/target/classes (Is a directory) -> [Help 1]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>...开发者_JS百科</groupId>
<artifactId>module2</artifactId>
<version>...</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Thanks.
I believe this is a bug in maven-dependency-plugin: http://jira.codehaus.org/browse/MDEP-259
While doing this in eclipse, unchecking the "Resolve workspace artifacts" got rid of the error, and I could do a clean install successfully.
Check if you are using eclipse lifecycle mapping in your pom and if so, check the plugin version. For me, it was maven-dependency-plugin 2.1 (buggy) instead of 2.0 used by command line maven.
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.0,2.0.8) <!-- 2.1 fails the build due to the http://jira.codehaus.org/browse/MDEP-187 -->
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
精彩评论