spring boot项目将配置文件打包在外部
2021-02-06 16:15
标签:tput conf lap mic esc xmlns isp boot cti 参考文件 1.pom.xml 2.package.xml spring boot项目将配置文件打包在外部 标签:tput conf lap mic esc xmlns isp boot cti 原文地址:https://www.cnblogs.com/z-test/p/12781384.html一、打成jar包不应该包含配置文件
二、添加打成压缩包的插件,配置插件中添加项目的配置文件
1 build>
2
3 finalName>${artifactId}finalName>
4 plugins>
5 plugin>
6 groupId>org.springframework.bootgroupId>
7 artifactId>spring-boot-maven-pluginartifactId>
8 executions>
9 execution>
10 goals>
11 goal>repackagegoal>
12 goals>
13 execution>
14 executions>
15 configuration>
16 includeSystemScope>trueincludeSystemScope>
17 configuration>
18 plugin>
19 plugin>
20 groupId>org.apache.maven.pluginsgroupId>
21 artifactId>maven-assembly-pluginartifactId>
22 configuration>
23 descriptors>
24 descriptor>src/main/assembly/package.xmldescriptor>
25 descriptors>
26 configuration>
27 executions>
28 execution>
29 id>make-assemblyid>
30 phase>packagephase>
31 goals>
32 goal>singlegoal>
33 goals>
34 execution>
35 executions>
36 plugin>
37 plugins>
38 resources>
39 resource>
40 directory>src/main/javadirectory>
41 includes>
42 include>**/*.xmlinclude>
43 includes>
44 filtering>truefiltering>
45 resource>
46 resource>
47 directory>src/main/resourcesdirectory>
48 excludes>
49 exclude>**/*.propertiesexclude>
50 exclude>**/*.ymlexclude>
51 excludes>
52 filtering>falsefiltering>
53 resource>
54 resource>
55 directory>lib/directory>
56 targetPath>libtargetPath>
57 includes>
58 include>**/*.jarinclude>
59 includes>
60 resource>
61 resources>
62 build>
xml version="1.0" encoding="UTF-8"?>
assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
id>packageid>
formats>
format>zipformat>
formats>
includeBaseDirectory>trueincludeBaseDirectory>
fileSets>
fileSet>
directory>${project.basedir}directory>
outputDirectory>/outputDirectory>
includes>
include>README*include>
include>LICENSE*include>
include>NOTICE*include>
include>build.infoinclude>
includes>
fileSet>
fileSet>
directory>${project.basedir}/src/main/resourcesdirectory>
outputDirectory>/outputDirectory>
includes>
include>*.propertiesinclude>
includes>
fileSet>
fileSet>
directory>${project.build.directory}directory>
outputDirectory>/outputDirectory>
includes>
include>*.jarinclude>
includes>
fileSet>
fileSets>
assembly>
上一篇:Unity中创建多边形并计算面积
下一篇:spring中的观察者模式
文章标题:spring boot项目将配置文件打包在外部
文章链接:http://soscw.com/index.php/essay/51792.html