maven jar 插件:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <configuration> <archive> <index>true</index> <manifest> <addClasspath>false</addClasspath> <mainClass>com.xxx.XxxClass</mainClass> </manifest> <!-- <manifestEntries> <key>value</key> </manifestEntries> --> </archive> </configuration> </plugin>
或者:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.3</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.sqtoon.pressuretest.OperateEntity</mainClass> </transformer> </transformers> <shadedArtifactAttached>true</shadedArtifactAttached> <!-- <shadedClassifierName>executable</shadedClassifierName> --> </configuration> </execution> </executions> </plugin>