直入正题:
POM文件中配置
方法一:
<build>
<finalName>entrance</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>packname.classname</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project><!-- 结束 -->
————————————————
方法二:https://www.jianshu.com/p/7a0e20b30401
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>packname.classname</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build><!-- 结束 -->
笔者就了解这两种方法,欢迎提供其他方法
————————————————
版权声明:本文为CSDN博主「GuanHao」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_17348297/article/details/79092383
网友评论