欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

springBoot項(xiàng)目打包idea的多種方法

 更新時(shí)間:2020年07月07日 10:57:41   作者:Y_R_Q  
這篇文章主要介紹了springBoot項(xiàng)目打包idea的多種方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

War包

1.首先在啟動(dòng)類(lèi)繼承SpringBootServletInitializer

@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(DemoApplication.class);
	}
	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}
}

2.把項(xiàng)目pom文件改成war文件

<groupId>com.code</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

3.加入tomcat去貓依賴(lài)

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-tomcat</artifactId>
	<scope>provided</scope>
</dependency>

點(diǎn)擊右鍵項(xiàng)目
然后點(diǎn)擊OPen Module Settings(或者直接按F4)
點(diǎn)擊Artifatcs ===》點(diǎn)擊+號(hào) 》Web Application:Exploded》點(diǎn)擊from Modules…
然后再點(diǎn)擊+號(hào) 》Web Application:Archive》點(diǎn)擊第二項(xiàng)
點(diǎn)擊勾選Include in project build
點(diǎn)擊右下角 Apply 》OK
然后回主頁(yè)點(diǎn)擊工具欄中的Build》build Artifatcs ==》all Artifatcs ==》build
等待執(zhí)行就成功啦
然后把打包好的項(xiàng)目放入tomcat中的webapp目錄下,運(yùn)行

Jar包

方法一

不用其他操作,直接
點(diǎn)擊右鍵項(xiàng)目
然后點(diǎn)擊OPen Module Settings(或者直接按F4)
點(diǎn)擊Artifatcs ===》點(diǎn)擊+號(hào) ==》JAr》點(diǎn)擊from Modules with dependencies…
然后彈出頁(yè)面
在Main Class選中驅(qū)動(dòng)類(lèi)
在jar file from libraries 單選中 copy to the output directory and link via manifest,點(diǎn)擊OK
點(diǎn)擊勾選Include in project build
點(diǎn)擊右下角 Apply 》OK
然后回主頁(yè)點(diǎn)擊工具欄中的Build》build Artifatcs ==》all Artifatcs ==》build
等待執(zhí)行就成功啦

把架包全部拷貝出來(lái)
使用命令
java -jar xxx.jar xxx為你的項(xiàng)目包名

方法二

點(diǎn)擊右側(cè)Maven projects
打開(kāi)Lifecycle , 把上面閃電圖標(biāo)點(diǎn)亮
雙擊clean 清空原先的,成功后
雙擊package 等待執(zhí)行打包成功

總結(jié)

到此這篇關(guān)于springBoot項(xiàng)目打包idea的多種方法的文章就介紹到這了,更多相關(guān)springBoot項(xiàng)目打包idea內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論