spingboot打jar包
Posted javaddd
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spingboot打jar包相关的知识,希望对你有一定的参考价值。
pom.xml文件中packaging为jar
<packaging>jar</packaging>
安装插件
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <mainClass>com.ysusoft.nowidwatcher.NowidwatcherApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-5</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <!--<mainClass>com.bms.Main.Main</mainClass>--> <mainClass>com.ysusoft.nowidwatcher.NowidwatcherApplication</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>assemble-all</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
用idea开发工具,点击右侧【maven project】先clean,然后再package,就会把jar包打进target目录中
以上是关于spingboot打jar包的主要内容,如果未能解决你的问题,请参考以下文章