一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|JavaScript|易語言|

服務器之家 - 編程語言 - JAVA教程 - Spring Boot創(chuàng)建非可執(zhí)行jar包的實例教程

Spring Boot創(chuàng)建非可執(zhí)行jar包的實例教程

2021-04-01 11:39馬軍偉 JAVA教程

這篇文章主要介紹了Spring Boot創(chuàng)建非可執(zhí)行jar包的實例教程,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

我們經常會有這種場景,只需要把Spring Boot打成普通的jar包,不包含配置文件,供其他程序應用

本文介紹如何使用Maven將Spring Boot應用打成普通的非可執(zhí)行jar包。

配置maven-jar-plugin

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <classifier>exec</classifier>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <executions>
        <execution>
          <id>exec</id>
          <phase>package</phase>
          <goals>
            <goal>jar</goal>
          </goals>
          <configuration>
            <classifier>exec</classifier>
          </configuration>
        </execution>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>jar</goal>
          </goals>
          <configuration>
            <!-- Need this to ensure application.yml is excluded -->
            <forceCreation>true</forceCreation>
            <excludes>
              <exclude>application.yml</exclude>
            </excludes>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

執(zhí)行mvn clean package打包

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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] ------------------------------------------------------------------------

下載實例源碼

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。

原文鏈接:http://www.majunwei.com/view/201708072141523612.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 大吊小说 | 国产精品久久久久久久久99热 | 石原莉奈被店长侵犯免费 | 国产成人亚洲影视在线 | 日韩伦理在线看 | 艾秋麻豆果冻传媒老狼仙踪林 | rylskyart系列视频| 果冻传媒天美传媒乌鸦传媒 | 男女被爆动漫羞羞动漫 | 天堂8在线天堂资源bt | 免费看又黄又爽又猛的视频软件- | 涩涩屋视频在线观看 | 三级黄色片在线观看 | 国产v视频 | 久久视频在线视频观看精品15 | 四虎麻豆国产精品 | 日韩欧美综合在线二区三区 | 亚洲香蕉网久久综合影院3p | 帅老头恋帅老头同性tv | h片免费网站 | 国产精品va在线观看不 | 精品欧美一区二区三区在线观看 | 69日本xxxx| 天堂伊人| 四虎影院入口 | 国产成人刺激视频在线观看 | 精品国产成人高清在线 | 男女性gif抽搐出入视频 | 九九热在线视频观看这里只有精品 | 亚洲黄色免费在线观看 | 国产自拍视频一区 | 韩国三级hd中文字幕李采潭 | 干美女视频 | 国产精品一区二区不卡的视频 | 欧洲破处 | 美国女网址www呦女 美国复古性经典xxxxx | 国产 日韩 一区 | 国产免费又粗又猛又爽视频国产 | 国产不卡视频一区二区在线观看 | t66y地址一地址二地址三 | gay帅老头毛都白了 gayxxx视频 |