新聞中心
這里有您想知道的互聯(lián)網營銷解決方案
SpringBoot如何創(chuàng)建非可執(zhí)行jar包
這篇文章給大家分享的是有關Spring Boot如何創(chuàng)建非可執(zhí)行jar包的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
創(chuàng)新互聯(lián)專注于韶山網站建設服務及定制,我們擁有豐富的企業(yè)做網站經驗。 熱誠為您提供韶山營銷型網站建設,韶山網站制作、韶山網頁設計、韶山網站官網定制、成都微信小程序服務,打造韶山網絡公司原創(chuàng)品牌,更為您提供韶山網站排名全網營銷落地服務。
我們經常會有這種場景,只需要把Spring Boot打成普通的jar包,不包含配置文件,供其他程序應用
本文介紹如何使用Maven將Spring Boot應用打成普通的非可執(zhí)行jar包。
配置maven-jar-plugin
org.springframework.boot spring-boot-maven-plugin exec maven-jar-plugin exec package jar exec package jar true application.yml
執(zhí)行mvn clean package打包
localhost:spring-boot-tutorial-non-executable majunwei$ mvn clean package [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.majunwei:spring-boot-tutorial-non-executable:jar:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ com.majunwei:spring-boot-tutorial-non-executable:[unknown-version], /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/pom.xml, line 26, column 17 [WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ com.majunwei:spring-boot-tutorial-non-executable:[unknown-version], /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/pom.xml, line 19, column 17 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building spring-boot-tutorial-non-executable 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-boot-tutorial-non-executable --- [INFO] Deleting /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-tutorial-non-executable --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot-tutorial-non-executable --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/target/classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-tutorial-non-executable --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot-tutorial-non-executable --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ spring-boot-tutorial-non-executable --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ spring-boot-tutorial-non-executable --- [INFO] Building jar: /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/target/spring-boot-tutorial-non-executable-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- maven-jar-plugin:2.4:jar (exec) @ spring-boot-tutorial-non-executable --- [INFO] Building jar: /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/target/spring-boot-tutorial-non-executable-0.0.1-SNAPSHOT-exec.jar [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default) @ spring-boot-tutorial-non-executable --- [INFO] Building jar: /Users/majunwei/Documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/target/spring-boot-tutorial-non-executable-0.0.1-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.692 s [INFO] Finished at: 2017-08-07T18:22:50+08:00 [INFO] Final Memory: 17M/174M [INFO] ------------------------------------------------------------------------
感謝各位的閱讀!關于“Spring Boot如何創(chuàng)建非可執(zhí)行jar包”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
網站欄目:SpringBoot如何創(chuàng)建非可執(zhí)行jar包
標題路徑:http://ef60e0e.cn/article/psgjhj.html