配置修改
This commit is contained in:
136
pom.xml
136
pom.xml
@@ -136,6 +136,18 @@
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
<!--打包时将resource下的文件一起打包-->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/**</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -151,60 +163,86 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<!-- 生成API文档插件 -->
|
||||
<!--<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>-->
|
||||
|
||||
<!--打jar包,排除资源文件和依赖jar,同时外部的lib、resource目录加入到classpath中, 用命令java -jar运行jar时就不需要用-Dloader.path指定外部资源路径了! 不需要spring-boot-maven-plugin插件 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<!--MANIFEST.MF 中 Class-Path 加入前缀!用命令java -jar运行jar时就不用-Dloader.path指定外部资源路径了-->
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
<!--jar包名字是否包含唯一版本标识-->
|
||||
<useUniqueVersions>false</useUniqueVersions>
|
||||
<!--指定含main方法的主类入口-->
|
||||
<mainClass>com.dpkj.Application</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<!--MANIFEST.MF 中 Class-Path 加入资源文件目录!用命令java -jar时就不用-Dloader.path指定外部资源路径了 -->
|
||||
<Class-Path>resources/</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
<!-- 打包时从jar包里排除资源文件 -->
|
||||
<excludes>
|
||||
<exclude>*.yml</exclude>
|
||||
<exclude>*.xml</exclude>
|
||||
<exclude>templates/**</exclude>
|
||||
<exclude>win32-x86-64/**</exclude>
|
||||
<exclude>win32-x86/**</exclude>
|
||||
</excludes>
|
||||
<!-- 指定项目打成jar包输出位置 -->
|
||||
<outputDirectory>${project.build.directory}/output</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 拷贝依赖jar包!插件maven-jar-plugin只是打包排除文件, 而把依赖jar包拷贝到外部lib目录就需要maven-dependency-plugin插件 -->
|
||||
<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>${project.build.directory}/output/lib/</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!--拷贝资源文件! 插件maven-jar-plugin只负责打包时排除文件, 而把资源文件拷贝到外部resource目录就需要maven-dependency-plugin插件-->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<resources>
|
||||
<resource>
|
||||
<!--拷贝此目录下的所有文件到指定的外部目录。只负责拷贝,而不是从jar包中排除!-->
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<!-- 把“<resource><directory>”指定目录中的文件输出到此处指定目录 -->
|
||||
<outputDirectory>${project.build.directory}/output/resources</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- 不需要分开打包的就将下面的插件全部注释-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!-- <artifactId>maven-dependency-plugin</artifactId>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <id>copy-dependencies</id>-->
|
||||
<!-- <phase>prepare-package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>copy-dependencies</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <!– 拷贝项目依赖包到lib/目录下 –>-->
|
||||
<!-- <outputDirectory>${project.build.directory}/lib</outputDirectory>-->
|
||||
<!-- <overWriteReleases>false</overWriteReleases>-->
|
||||
<!-- <overWriteSnapshots>false</overWriteSnapshots>-->
|
||||
<!-- <overWriteIfNewer>true</overWriteIfNewer>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <layout>ZIP</layout>-->
|
||||
<!-- <includes>-->
|
||||
<!-- <include>-->
|
||||
<!-- <groupId>nothing</groupId>-->
|
||||
<!-- <artifactId>nothing</artifactId>-->
|
||||
<!-- </include>-->
|
||||
<!-- </includes>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </plugin>-->
|
||||
|
||||
|
||||
</plugins>
|
||||
<!--打包时将resource下的文件一起打包-->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/**</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user