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

颜欣怡
2023-12-01
  1. <build>  
  2.         <pluginManagement>  
  3.             <plugins>  
  4.                 <plugin>  
  5.                     <groupId>org.eclipse.m2e</groupId>  
  6.                     <artifactId>lifecycle-mapping</artifactId>  
  7.                     <version>1.0.0</version>  
  8.                     <configuration>  
  9.                         <lifecycleMappingMetadata>  
  10.                             <pluginExecutions>  
  11.                                 <pluginExecution>  
  12.                                     <pluginExecutionFilter>  
  13.                                         <groupId>org.apache.maven.plugins</groupId>  
  14.                                         <artifactId>maven-dependency-plugin</artifactId>  
  15.                                         <versionRange>[2.0,)</versionRange>  
  16.                                         <goals>  
  17.                                             <goal>copy-dependencies</goal>  
  18.                                         </goals>  
  19.                                     </pluginExecutionFilter>  
  20.                                     <action>  
  21.                                         <ignore />  
  22.                                     </action>  
  23.                                 </pluginExecution>  
  24.                             </pluginExecutions>  
  25.                         </lifecycleMappingMetadata>  
  26.                     </configuration>  
  27.                 </plugin>  
  28.             </plugins>  
  29.         </pluginManagement>  
  30.         <plugins>  
  31.             <plugin>  
  32.                 <groupId>org.apache.maven.plugins</groupId>  
  33.                 <artifactId>maven-dependency-plugin</artifactId>  
  34.                 <executions>  
  35.                     <execution>  
  36.                         <id>copy-dependencies</id>  
  37.                         <phase>package</phase>  
  38.                         <goals>  
  39.                             <goal>copy-dependencies</goal>  
  40.                         </goals>  
  41.                         <configuration>  
  42.                             <outputDirectory>${project.build.directory}/lib</outputDirectory>  
  43.                             <excludeTransitive>false</excludeTransitive>  
  44.                             <stripVersion>true</stripVersion>  
  45.                         </configuration>  
  46.                     </execution>  
  47.                 </executions>  
  48.             </plugin>  
  49.         </plugins>  
  50.     </build> 

 

上面的是  原来帖子的,

这个是 我加上去的

<build>
    
    <pluginManagement>  
            <plugins>  
                <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>[2.0,)</versionRange>  
                                        <goals>  
                                            <goal>copy-dependencies</goal>  
                                        </goals>  
                                    </pluginExecutionFilter>  
                                    <action>  
                                        <ignore />  
                                    </action>  
                                </pluginExecution>  
                            </pluginExecutions>  
                        </lifecycleMappingMetadata>  
                    </configuration>  
                </plugin>  
            </plugins>  
        </pluginManagement>  
    
        <plugins>
            <plugin>
                <groupId>com.google.code.sortpom</groupId>
                <artifactId>maven-sortpom-plugin</artifactId>
                <version>2.3.0</version>
            </plugin>
            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-dependency-plugin</artifactId>  
                <executions>  
                    <execution>  
                        <id>copy</id>  
                        <phase>package</phase>  
                        <goals>  
                            <goal>copy-dependencies</goal>  
                        </goals>  
                        <configuration>  
                            <outputDirectory>  
                                ${project.build.directory}/lib  
                            </outputDirectory>  
                        </configuration>  
                    </execution>  
                </executions>  
            </plugin>
        </plugins>
    </build>

经过测试可以解决这个问题, 最好 更新一下maven项目即可

转载于:https://my.oschina.net/ouminzy/blog/783873

 类似资料: