700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Idea利用maven打包spring boot项目

Idea利用maven打包spring boot项目

时间:2021-08-20 11:29:28

相关推荐

Idea利用maven打包spring boot项目

1、pom.xml文件中增加以下配置

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions><configuration><mainClass>com.konsy.TestProjectApplication</mainClass></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-release-plugin</artifactId><version>2.5.3</version></plugin></plugins></build>

2、点击maven插件中的package

3、到target目录下找到jar包

执行 java -jar xxxx.jar即可执行

4.如果是打第三方库

需要增加

<dependency><groupId>xxx.xxx.xxx</groupId> <!--自定义--><artifactId>xxx</artifactId> <!--自定义--><version>1.0</version> <!--自定义--><scope>system</scope> <!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它--><systemPath>${basedir}/libs/xxx.jar</systemPath> <!--项目根目录下的lib文件夹下--></dependency>

同时

<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><includeSystemScope>true</includeSystemScope></configuration></plugin>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。