|
@@ -13,13 +13,92 @@
|
|
|
|
|
|
<build>
|
|
|
<plugins>
|
|
|
+ <!-- 分离lib -->
|
|
|
+ <plugin>
|
|
|
+ <!--这个插件就是把依赖的jar包复制出来放到编译后的target/lib目录,并且在打包时候排除内部依赖-->
|
|
|
+ <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>
|
|
|
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
|
|
|
+ <overWriteReleases>false</overWriteReleases>
|
|
|
+ <overWriteSnapshots>false</overWriteSnapshots>
|
|
|
+ <overWriteIfNewer>true</overWriteIfNewer>
|
|
|
+ </configuration>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
+ </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>
|
|
|
+ <directory>src/main/resources</directory>
|
|
|
+ </resource>
|
|
|
+ </resources>
|
|
|
+ <outputDirectory>${project.build.directory}/resources</outputDirectory>
|
|
|
+ </configuration>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
+ </plugin>
|
|
|
+ <!--打包jar-->
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
|
+ <artifactId>maven-jar-plugin</artifactId>
|
|
|
+ <configuration>
|
|
|
+ <archive>
|
|
|
+ <!-- 指定资源文件目录,与打包的jar文件同级目录 -->
|
|
|
+ <manifestEntries>
|
|
|
+ <Class-Path>resources/</Class-Path>
|
|
|
+ </manifestEntries>
|
|
|
+ <manifest>
|
|
|
+ <addClasspath>true</addClasspath>
|
|
|
+ <classpathPrefix>lib/</classpathPrefix>
|
|
|
+ <mainClass>com.alvin.Application</mainClass>
|
|
|
+ </manifest>
|
|
|
+ </archive>
|
|
|
+ <!-- 打包时忽略的文件(也就是不打进jar包里的文件),本例将resources下的.yml、.xml、.db文件全部排除 -->
|
|
|
+ <excludes>
|
|
|
+ <exclude>**/*.yml</exclude>
|
|
|
+ <exclude>**/*.xml</exclude>
|
|
|
+ <exclude>**/*.db</exclude>
|
|
|
+ </excludes>
|
|
|
+ </configuration>
|
|
|
+ </plugin>
|
|
|
+ <!-- spring boot repackage -->
|
|
|
<plugin>
|
|
|
<groupId>org.springframework.boot</groupId>
|
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
|
<configuration>
|
|
|
- <fork>true</fork>
|
|
|
<layout>ZIP</layout>
|
|
|
+ <includes>
|
|
|
+ <include>
|
|
|
+ <groupId>non-exists</groupId>
|
|
|
+ <artifactId>non-exists</artifactId>
|
|
|
+ </include>
|
|
|
+ </includes>
|
|
|
</configuration>
|
|
|
+ <executions>
|
|
|
+ <execution>
|
|
|
+ <goals>
|
|
|
+ <goal>repackage</goal>
|
|
|
+ </goals>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
</plugin>
|
|
|
</plugins>
|
|
|
</build>
|