欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-07-15 08:19:54
...

解决办法:在plugins之前添加如下pluginManagement,二者前后顺序如下:

 

[html] view plaincopy
 
  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>