`

解决maven-dependency-plugin (goals “copy-dependencies”, “unpack”) is not supported

 
阅读更多

POM文件报错maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.,
则查看<build>中的<plugin>中是否有
<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>[1.0.0,)</versionRange>
         <goals>
          <goal>copy-dependencies</goal>
          <goal>unpack</goal>
         </goals>
        </pluginExecutionFilter>
        <action>
         <ignore />
        </action>
       </pluginExecution>
      </pluginExecutions>
     </lifecycleMappingMetadata>
    </configuration>
   </plugin>
如果没有,则直接在<build>里的已有的<plugins>前面加上

<pluginManagement>
  <plugins>
  <!-- Ignore/Execute plugin execution -->
   <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>[1.0.0,)</versionRange>
         <goals>
          <goal>copy-dependencies</goal>
          <goal>unpack</goal>
         </goals>
        </pluginExecutionFilter>
        <action>
         <ignore />
        </action>
       </pluginExecution>
      </pluginExecutions>
     </lifecycleMappingMetadata>
    </configuration>
   </plugin>
  </plugins>
  </pluginManagement>

另外要保证后面的<plugins>中有
<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.6</version>
    <executions>
     <execution>
      <id>copy-dependencies</id>
      <phase>package</phase>
      <goals>
       <goal>copy-dependencies</goal>
      </goals>
      <configuration>
       <outputDirectory>${project.build.directory}/lib</outputDirectory>
       <overWriteReleases>false</overWriteReleases>
       <overWriteSnapshots>false</overWriteSnapshots>
       <overWriteIfNewer>true</overWriteIfNewer>
       <excludeTransitive>true</excludeTransitive>
      </configuration>
     </execution>
    </executions>
   </plugin>
存在;

若已经有了
<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>[1.0.0,)</versionRange>
         <goals>
          <goal>copy-dependencies</goal>
          <goal>unpack</goal>
         </goals>
        </pluginExecutionFilter>
        <action>
         <ignore />
        </action>
       </pluginExecution>
      </pluginExecutions>
     </lifecycleMappingMetadata>
    </configuration>
   </plugin>
则将其删掉,按照前面没有的方式做一边,然后用Maven update project即可。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics