maven打包插件的配置
以下代码包含打普通jar包和fat jar(uber jar)包:
<build>
<finalName>最终生成的jar包名字</finalName>
<!-- <plugins> -->
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-dependency-plugin</artifactId> -->
<!-- <version>3.0.0</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <id>copy-dependencies</id> -->
<!-- <phase>prepare-package</phase> -->
<!-- <goals> -->
<!-- <goal>copy-dependencies</goal> -->
<!-- </goals> -->
<!-- <configuration> -->
<!-- <outputDirectory>${project.build.directory}/lib</outputDirectory> -->
<!-- <overWriteReleases>false</overWriteReleases> -->
<!-- <overWriteSnapshots>false</overWriteSnapshots> -->
<!-- <overWriteIfNewer>true</overWriteIfNewer> -->
<!-- </configuration> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- </plugin> -->
<!-- <plugin> -->
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-dependency-plugin</artifactId> -->
<!-- <version>3.0.1</version> -->
<!-- <configuration> -->
<!-- <archive> -->
<!-- <manifest> -->
<!-- <addClasspath>true</addClasspath> -->
<!-- <classpathPrefix>lib/</classpathPrefix> -->
<!-- <mainClass>com.yourcompay.Demo</mainClass> -->
<!-- </manifest> -->
<!-- </archive> -->
<!-- </configuration> -->
<!-- </plugin> -->
<!-- </plugins> -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>com.test.Hello</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>