解決maven-dependency-plugin

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>前面加上apache

<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>app

另外要保證後面的<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>
存在;eclipse

若已經有了
<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便可。maven

相關文章
相關標籤/搜索