国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

一文解決springboot打包成jar文件無法正常運行的問題

瀏覽:47日期:2023-05-07 08:52:39

1.用intellij idea 創建了一個springboot的項目,前期都運行的好好的,在ide中可以正常運行,但是打包成Jar運行卻一直報錯。

2.經過不懈探索,終于找到解決辦法

3.首先,找到pom.xml,把下面的build塊中的內容改成如下所示

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!--這里寫上main方法所在類的路徑--> <configuration> <mainClass>server.demo.DemoApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

4.然后,請千萬不要用Intellij idea來打包項目為Jar,你應該來到項目的根目錄,然后用 mvn clean package 這個命令來打包,如圖所示:

5.然后在target目錄下,可以得到jar文件

6.然后就可以正常運行了,親測有效,希望可以幫助各位

附錄:springboot打包成jar文件無法正常運行, bat啟動缺少jar文件

問題描述:

使用idea打包springboot項目成jar包, 想制作成bat命令來啟動, 啟動缺少jar文件

一文解決springboot打包成jar文件無法正常運行的問題

問題原因:

springboot項目打包, 不能用idea自帶的命令, 需要使用maven來打包

解決辦法:

1.用intellij idea 創建了一個springboot的項目,前期都運行的好好的,在idea中可以正常運行,但是打包成jar運行卻一直報錯。

2.首先,找到pom.xml,把下面的build塊中的內容改成如下所示

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><!--這里寫上main方法所在類的路徑--><configuration> <mainClass>server.demo.DemoApplication</mainClass></configuration><executions> <execution> <goals> <goal>repackage</goal> </goals> </execution></executions></plugin></plugins></build>

3.然后,請千萬不要用Intellij idea來打包項目為Jar,你應該來到項目的根目錄,然后用 mvn clean package 這個命令來打包,如圖所示:

一文解決springboot打包成jar文件無法正常運行的問題

4.然后在target目錄下,可以得到jar文件

一文解決springboot打包成jar文件無法正常運行的問題

5.然后就可以正常運行了,親測有效,希望可以幫助各位

一文解決springboot打包成jar文件無法正常運行的問題

到此這篇關于一文解決springboot打包成jar文件無法正常運行的問題的文章就介紹到這了,更多相關springboot打包jar文件內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 满洲里市| 林口县| 龙川县| 通海县| 耿马| 陕西省| 安徽省| 疏附县| 万全县| 静乐县| 长治市| 伊吾县| 台中县| 措美县| 庆安县| 衡水市| 梅州市| 吴堡县| 平潭县| 房产| 乌拉特后旗| 奇台县| 玉屏| 连平县| 从江县| 永寿县| 从江县| 顺昌县| 泰州市| 通许县| 唐海县| 五指山市| 民乐县| 阳谷县| 永靖县| 宜黄县| 徐水县| 柏乡县| 辽阳县| 嘉兴市| 新昌县|