当前位置:   article > 正文

教你Maven打包插件:如何把依赖包打包到lib,依赖包打包到jar中?_maven-assembly-plugin添加依赖包到lib

maven-assembly-plugin添加依赖包到lib
<!--打包插件,jar包和依赖包分开,依赖包打包到lib下   测试可行-->
  1. <plugin>
  2. <groupId>org.apache.maven.plugins</groupId>
  3. <artifactId>maven-jar-plugin</artifactId>
  4. <version>2.6</version>
  5. <configuration>
  6. <archive>
  7. <manifest>
  8. <addClasspath>true</addClasspath>
  9. <classpathPrefix>lib/</classpathPrefix>
  10. <mainClass>com.xxx.xxxService</mainClass>
  11. </manifest>
  12. </archive>
  13. </configuration>
  14. </plugin>
  15. <plugin>
  16. <groupId>org.apache.maven.plugins</groupId>
  17. <artifactId>maven-dependency-plugin</artifactId>
  18. <version>2.10</version>
  19. <executions>
  20. <execution>
  21. <id>copy-dependencies</id>
  22. <phase>package</phase>
  23. <goals>
  24. <goal>copy-dependencies</goal>
  25. </goals>
  26. <configuration>
  27. <outputDirectory>${project.build.directory}/lib</outputDirectory>
  28. </configuration>
  29. </execution>
  30. </executions>
  31. </plugin>
<!--打包,把依赖包打包到jar内 测试OK-->
  1. <!--<plugin>-->
  2. <!--<artifactId>maven-assembly-plugin</artifactId>-->
  3. <!--<configuration>-->
  4. <!--<descriptorRefs>-->
  5. <!--<descriptorRef>jar-with-dependencies</descriptorRef>-->
  6. <!--</descriptorRefs>-->
  7. <!--<archive>-->
  8. <!--<manifest>-->
  9. <!--<mainClass>com.xxx.xxxService</mainClass>-->
  10. <!--</manifest>-->
  11. <!--</archive>-->
  12. <!--</configuration>-->
  13. <!--<executions>-->
  14. <!--<execution>-->
  15. <!--<id>make-assembly</id>-->
  16. <!--<phase>package</phase>-->
  17. <!--<goals>-->
  18. <!--<goal>single</goal>-->
  19. <!--</goals>-->
  20. <!--</execution>-->
  21. <!--</executions>-->
  22. <!--</plugin>-->

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/308035
推荐阅读
相关标签
  

闽ICP备14008679号