maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.

Dear 丶 2022-06-06 05:24 154阅读 0赞

在maven项目构建时pom.xml文件报错:maven-dependency-plugin (goals “copy-dependencies”, “unpack”) is not supported by m2e.

报错部分配置如下:

[html] view plain copy

  1. <**plugin**>
  2. <**artifactId**>maven-dependency-plugin</**artifactId**>
  3. <**version**>2.6</**version**>
  4. <**executions**>
  5. <**execution**>
  6. <**id**>copy-dependencies</**id**>
  7. <**phase**>package</**phase**>
  8. <**goals**>
  9. <**goal**>copy-dependencies</**goal**>
  10. </**goals**>
  11. <**configuration**>
  12. <**outputDirectory**>${project.build.directory}/lib</**outputDirectory**>
  13. <**overWriteReleases**>false</**overWriteReleases**>
  14. <**overWriteSnapshots**>false</**overWriteSnapshots**>
  15. <**overWriteIfNewer**>true</**overWriteIfNewer**>
  16. <**excludeTransitive**>true</**excludeTransitive**>
  17. </**configuration**>
  18. </**execution**>
  19. </**executions**>
  20. </**plugin**>

最终研究得出的原因是Eclipse的M2E插件没有覆盖到这样的execution,为了解决这个问题,我们需要让其在maven的生命周期里不被识别,同时让M2e插件能认识、执行它。

我们需要在build标签里面,在plugins标签前面,加如下配置即可:

[html] view plain copy

  1. <**pluginManagement**>
  2. <**plugins**>
  3. <**plugin**>
  4. <**groupId**>org.eclipse.m2e</**groupId**>
  5. <**artifactId**>lifecycle-mapping</**artifactId**>
  6. <**version**>1.0.0</**version**>
  7. <**configuration**>
  8. <**lifecycleMappingMetadata**>
  9. <**pluginExecutions**>
  10. <**pluginExecution**>
  11. <**pluginExecutionFilter**>
  12. <**groupId**>org.apache.maven.plugins</**groupId**>
  13. <**artifactId**>maven-dependency-plugin</**artifactId**>
  14. <**versionRange**>2.6</**versionRange**>
  15. <**goals**>
  16. <**goal**>copy-dependencies</**goal**>
  17. </**goals**>
  18. </**pluginExecutionFilter**>
  19. <**action**>
  20. <**execute />**
  21. </**action**>
  22. </**pluginExecution**>
  23. </**pluginExecutions**>
  24. </**lifecycleMappingMetadata**>
  25. </**configuration**>
  26. </**plugin**>
  27. </**plugins**>
  28. </**pluginManagement**>

备注:注意顺序!

原文网址:http://blog.csdn.net/xufaxi/article/details/45021129

发表评论

表情:
评论列表 (有 0 条评论,154人围观)

还没有评论,来说两句吧...

相关阅读