Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after pac

导入一个新项目后pom.xml报错:

Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187 is thrown

经过在网上查找资料,将解决方案整理如下:

首先,这个是eclipse的插件m2e的问题,并不是真正的错误。

解决方案一

可以用一个<pluginManagement>把插件包住,这样eclipse里就不报错了。但是<pluginManagement>的使用场景是父项目里定义,然后子项目里继承使用。 这里加一个<pluginManagement>只是为了看不到这个错误感觉有点名不正言不顺。 最好的办法就是忽略,不去管他。

解决方案二

stackOverflow上有人给出另一种相似的解决方法:

点击Window -> Preferences -> Maven -> Lifecycle Mappings ,点击Open workspace lifecycle mappings metadata,Then add "pluginExecution" entry like in the code below. If the file is empty, copy the entire content below. You might need to change "versionRange".

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
  <pluginExecutions>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <versionRange>2.10</versionRange>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
  </pluginExecutions>
</lifecycleMappingMetadata>

In order for this to take effect go back to Preferences and click Reload workspace lifecycle mappings metadata. Update maven projects and / or rebuild. The error should be gone.

Useful if you cannot or don't want to modify pom.xml for any reasons but want to stop your eclipse m2e from executing particular goal of a particular plugin.

(上面的英文应该都看得懂,就懒得翻译了)

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值