maven-dependency-plugin:copy 尝试复制类
我有父 pom 和两个模块 pom。在第一个模块中,我想将第二个模块(jar)复制到某个文件夹。当我从第一个模块 pom 编译项目时 - 它可以工作,但是当我尝试从父项目 pom 编译时,插件尝试复制 jar 的模块类:
[错误]执行目标失败 org.apache.maven.plugins:maven-dependency-plugin:2.1:复制 (默认)在项目模块1上: 复制工件时出错 /home/chardex/projects/test/module2/target/classes 到 /home/chardex/projects/test/module1/target/lib/classes: /home/chardex/projects/test/module2/target/classes (是一个目录)-> [帮助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>...</groupId>
<artifactId>module2</artifactId>
<version>...</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
谢谢。
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>...</groupId>
<artifactId>module2</artifactId>
<version>...</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信这是 maven-dependency-plugin 中的错误: http://jira.codehaus.org/browse/MDEP-259
I believe this is a bug in maven-dependency-plugin: http://jira.codehaus.org/browse/MDEP-259
在 Eclipse 中执行此操作时,取消选中“解决工作区工件”消除了错误,并且我可以成功执行全新安装。
While doing this in eclipse, unchecking the "Resolve workspace artifacts" got rid of the error, and I could do a clean install successfully.
检查您的 pom 中是否使用 eclipse 生命周期映射,如果是,请检查插件版本。对我来说,它是 maven-dependency-plugin 2.1 (有缺陷),而不是命令行 maven 使用的 2.0。
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.