国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

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

服務(wù)器之家 - 編程語言 - JAVA教程 - Spring boot 打jar包分離lib的正確配置方式

Spring boot 打jar包分離lib的正確配置方式

2021-04-07 13:33小祝特?zé)?/span> JAVA教程

spring boot打jar包分離lib后,配置文件的方式,在網(wǎng)上可以搜到很多答案,但是都不夠完善,今天小編給大家?guī)砹薙pring boot 打jar包分離lib的正確配置方式,感興趣的朋友一起看看吧

前言

Springboot 打jar包分離lib,配置文件的方式,網(wǎng)上可以搜到的我都沒試通。跟劉大神(大神沒有博客,很可惜)討論后,給出了這么一個(gè)解決方案,供大家參考。

部署環(huán)境

  • window 10
  • redhat 6.4
  • 其他版本沒有嘗試,應(yīng)該也是可以的

POM.xml

?
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.elvish</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>test</name>
  <description>test</description>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <relativePath />
  </parent>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>target/lib</outputDirectory>
              <excludeTransitive>false</excludeTransitive>
              <stripVersion>false</stripVersion>
              <includeScope>runtime</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*.properties</exclude>
            <exclude>**/*.xml</exclude>
            <exclude>**/*.yml</exclude>
            <exclude>static/**</exclude>
            <exclude>templates/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <layout>ZIP</layout>
          <includes>
            <include>
              <groupId>non-exists</groupId>
              <artifactId>non-exists</artifactId>
            </include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
            <configuration>
              <classifier>classes</classifier>
              <attach>false</attach>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="dist">target/distribution</property>
                <property name="dist-tmp">target/distribution/tmp</property>
                <property name="app-name">${project.artifactId}-${project.version}</property>
                <mkdir dir="${dist-tmp}" />
                <copy file="target/${app-name}.jar" tofile="${dist-tmp}/${app-name}.jar" />
                <unzip src="${dist-tmp}/${app-name}.jar" dest="${dist-tmp}" />
                <delete file="${dist-tmp}/${app-name}.jar" />
                <zip destfile="${dist}/${app-name}-pages.jar">
                  <zipfileset dir="${dist-tmp}/META-INF" prefix="META-INF" />
                  <zipfileset dir="target/classes/static" prefix="static" />
                  <zipfileset dir="target/classes/templates" prefix="templates" />
                </zip>
                <move file="target/${app-name}-classes.jar" todir="${dist}" />
                <move todir="${dist}/3rd-lib">
                  <fileset dir="target/lib" />
                </move>
                <delete dir="${dist-tmp}" />
                <copy todir="${dist}">
                  <fileset dir="target/classes">
                    <include name="**/*.properties" />
                    <include name="**/*.xml" />
                    <include name="**/*.yml" />
                  </fileset>
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

打完包后目錄結(jié)構(gòu)

  • 3rd-lib
  • META-INF
  • *.yml
  • *.xml
  • *.properties
  • test-0.0.1-SNAPSHOT-classes.jar
  • test-0.0.1-SNAPSHOT-pages.jar

運(yùn)行jar

?
1
java -jar -Dloader.path=.,3rd-lib test-0.0.1-SNAPSHOT-classes.jar

總結(jié)

以上所述是小編給大家介紹的Spring boot 打jar包分離lib的正確配置方式,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對服務(wù)器之家網(wǎng)站的支持!

原文鏈接:https://my.oschina.net/xiaozhutefannao/blog/1624092

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 久久精品国产99国产 | 久久久久久久久久久久国产 | 在线观看亚洲视频 | 欧美午夜影院 | 一个色综合色 | 色香蕉视频 | 精品一二三区 | 欧美电影在线观看网站 | 亚洲综合国产 | 免费自拍偷拍视频 | 欧美精品 | 成人午夜电影网 | 91精品久久| 欧美日韩视频在线观看免费 | 精品视频久久久 | 精品欧美一区二区久久久伦 | 日韩欧美一区二区三区在线观看 | 日本一区二区三区四区 | 欧美福利一区二区 | 黄色片子免费观看 | 亚洲天堂免费在线 | 视频一区二区三区在线观看 | av久草 | 久久久一| 九九九在线 | 成人免费视频网站在线观看 | 性色av一区二区三区 | 日韩视频一区二区 | 无码一区二区三区视频 | 久久国产福利 | 久草免费在线 | 亚洲成人精品 | 日韩二区 | 青青草网站| 国产一区二区三区在线 | 中文字幕在线观看 | 一区二区三区久久 | 欧美一区二区三区在线观看视频 | 人人人人澡人人爽人人澡 | 99精品欧美一区二区蜜桃免费 | 日韩在线视频观看 |