带依赖的Jar

  1. <plugin>
  2. <artifactId>maven-assembly-plugin</artifactId>
  3. <configuration>
  4. <descriptorRefs>
  5. <descriptorRef>jar-with-dependencies</descriptorRef>
  6. </descriptorRefs>
  7. </configuration>
  8. </plugin>

定制安装包

  1. <profiles>
  2. <profile>
  3. <id>release</id>
  4. <build>
  5. <plugins>
  6. <plugin>
  7. <groupId>org.apache.maven.plugins</groupId>
  8. <artifactId>maven-assembly-plugin</artifactId>
  9. <version>3.1.1</version>
  10. <configuration>
  11. <descriptors>
  12. <descriptor>src/main/resources/assemblies/assembly.xml</descriptor>
  13. </descriptors>
  14. </configuration>
  15. <executions>
  16. <execution>
  17. <id>make-assembly</id>
  18. <phase>package</phase>
  19. <goals>
  20. <goal>single</goal>
  21. </goals>
  22. </execution>
  23. </executions>
  24. </plugin>
  25. </plugins>
  26. </build>
  27. </profile>
  28. </profiles>

format:

支持的格式

  • zip
  • tar.gz
  • tar.bz2
  • jar
  • dir
  • war

执行脚本

打包命令

maven clean package -DskipTests -Prelease

文档更新时间: 2019-06-21 20:02