<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<!-- 指定该jar包启动时的主类[建议] -->
<mainClass>com.linewell.AppApplication</mainClass>
<layout>ZIP</layout>
<includes>
<!-- 排除第三方依赖jar(只保留本项目的jar) -->
<include>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
</include>
</includes>
</configuration>
</plugin>
<!-- 把项目依赖的第三方包打包在target/lib下 -->
<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}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<!-- 排除resources下的配置文件 -->
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>static/**</exclude>
<exclude>templates/**</exclude>
<exclude>*.yml</exclude>
<exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>*.json</exclude>
<exclude>codetemplate/**</exclude>
<exclude>lib/**</exclude>
</excludes>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
<!-- 打包lib下的jar包 -->
<resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
<finalName>sqjw</finalName>
</build>
新建一个独立目录,将targer/lib、sqjw.jar拷过去。
将src/main/resources/底下的配置文件(即resource排除的)也拷过去。
运行:
java -jar -Dloader.path=lib sqjw.jar
之后程序更新,只需要更新sqjw.jar,其他不变。