maven 打可执行jar包
程序员文章站
2022-05-01 12:40:29
...
把java项目中的依赖jar包也放入zip包种
1. 添加maven插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.asiainfo.shhd.run.AppMain</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>
<mainClass>com.asiainfo.shhd.run.AppMain</mainClass> 配置的是main方法的class
2. 执行打包命令
mvn assembly:assembly
4. 查找jar包
直接到target目录下*-SNAPSHOT-jar-with-dependencies.jar
转载于:https://my.oschina.net/KingPan/blog/496078
上一篇: java将class文件打成jar包
下一篇: 批处理之延时