우리는 종종 이런 종류의 시나리오를 가지고 있습니다. 다른 프로그램을 적용하려면 구성 파일이없는 일반 JAR 패키지로 스프링 부팅 만하면됩니다.
이 기사에서는 Maven을 사용하여 일반적인 비영리성 JAR 패키지로 스프링 부팅 애플리케이션을 만드는 방법에 대해 설명합니다.
Maven-Jar-Plugin을 구성하십시오
<빌드> <플러그인> <grugin> org.spramework.spramework.boot </groupId> <artifactid> spring-boot-maven-plugin </artifactid> <configuration> <classifier> exec </classifier> </configuration> </plugin> <id> exec </id> <couth> package </phase> <gace> <goal> jar </goal> </gover> <configuration> <clasifier> exec </configuration> </execution> <pase> 패키지 </phase> <goving> <Goal> </Goal> </Goals> <! <forcecreation> true </forcecreation> <excludes> <exclude> </exclude.yml </exclude> </excludes> </configuration> </execution> </executions> </plugin> </plugins> </build>
MVN Clean 패키지를 실행하십시오
LocalHost : Spring-Boot-Tutiorial-Non-Executable-Executable Majunwei $ MVN Clean Package [Info] 프로젝트 스캔 ... [경고] [경고] com.majunwei : Spring-Boot-Tutorial-Non-Excutable : JAR : 0.0.1-SNAPSHOT [경고] 'build.plugins. org.apache.maven.plugins : maven-jar-plugin이 누락되었습니다. @ com.majunwei : Spring-Boot-Tutorial-Non-Executable : [알 수없는-버전], /users/majunwei/documents/work/spring-boot-tutorial/spring-boot-tutorial-non-executable/pom.xml, 열 17 [경고] 'build.plugins.plugin org.springframework.boot : Spring-Boot-Maven-Plugin이 누락되었습니다. @ com.majunwei : Spring-Boot-Tutorial-Non-Executable : [알 수없는-버전], /users/majunwei/documents/work/spring-boot-tutorial/spring-boot-tutiorial-non-executable/pom.xml, column [경고] [경고] [경고] [경고] [경고에 대한 권장입니다.] [경고] [정보] [정보] -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /user/majunwei/documents/spring-boot-tutiorial/spring-boot-tutiorial-non-executable/target [info] [info] --- maven-resources-plugin : 2.6 : spring-boot-tutorial-non-executable --- [info] copyer to covering to info] [info] --- Maven-Compiler-Plugin : 3.1 : Compile (기본-컴파일) @ Spring-Boot-Tutorial-Non-Executable --- [Info] 변경-모듈을 다시 컴파일! [Info] 1 소스 파일을/user/work/spring-boot-tutorial/spring-bboot-tutorial-non-executable/target/classe/classe/classe/spring-bboot-tutial-non- Maven-Resources-Plugin : 2.6 : TestResources (Default-Testresources) @ Spring-Boot-Tutorial-Non-Executable --- [Info] 'UTF-8'인코딩을 사용하여 필터링 된 리소스를 복사합니다. /users/majunwei/documents/spring-boot-tutiorial/spring-boot-tutiorial-non-excutable/src/test [info] [info] --- maven-compiler-plugin : 3.1 : testCompile (default-testcompile) @ spring-boot-tutorial-non-excutable-- [정보]-모든 클래스가 Complile the Complile-worly classe-with compleik. Maven-Surefire-Plugin : 2.12.4 : 테스트 (기본 테스트) @ Spring-Boot-Tutorial-Non-Executable --- [Info] 실행할 테스트 없음. [Info] [info] --- Maven-Jar-Plugin : 2.4 : Jar (기본-부트-자르) @ Spring-Boot-Tutorial-Non-Excutable-- [Infial Jar. /users/majunwei/documents/work/spring-boot-boot-boot-tutorial/spring-boot-tutorial-non-executable/target/spring-boot-tutorial-non-executable-0.1-snapshot.jar [info] [info] --- maven-jar-plugin : JAR (jar) @. Spring-Boot-Tutorial-Non-Executable --- [Info] Building Jar : /users/majunwei/documents/work/spring-boot-boot-boot/spring-boot-tutorial-non-executable/target/spring-boot-boot-boot-boot-boot-boot-tutorial-non-executable-0.1-1-snapshot-jar/jar 평가. Maven-Jar-Plugin : 2.4 : 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.1-snapshot. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2017-08-07T18:22:50+08:00[INFO] Final Memory: 17M/174M[INFO] ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
인스턴스 소스 코드를 다운로드하십시오
위는이 기사의 모든 내용입니다. 모든 사람의 학습에 도움이되기를 바랍니다. 모든 사람이 wulin.com을 더 지원하기를 바랍니다.