springboot 打jar包时分离配置文件
2024-09-01 11:13:29
修改pom.xml文件
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<!--打包时排除掉资源文件-->
<excludes>
<exclude>**/**</exclude>
</excludes>
</resource>
</resources>
<plugins>
<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>
</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>
<!--target/lib是依赖jar包的输出目录,根据自己喜好配置-->
<outputDirectory>target/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
- 在target中把lib目录和jar文件再加了项目中的resource目录一起发布,启动命令是: java -jar -Dloader.path=.,resources,lib (可执行的jar包名称).jar
- win10 用cmd 不要用powershell
最新文章
- 《你不知道的JavaScript -- 上卷》笔记 --- 基于ES6新标准
- 你眼中的async/await是什么样的?
- Javac早期(编译期)
- PHP Mongodb 基本操作
- 开发流程习惯的养成—TFS简单使用
- UVa 12230 (期望) Crossing Rivers
- List<;HashMap>;和HashMap
- 如何使盘ISO图像文件
- CSS Day04 css核心基础
- 51nod 1231 记分牌
- 浏览器将URL变成一个屏幕上显示的网页的过程?
- Java线程和线程池
- iOS - User Agent 的应用和设置
- .NET手记-Autofac进阶(属性和方法注入 Property and Method Injection)
- HTML编辑器 -- KindEditor
- laravel的重定向
- POJ 2771
- javascript研究小组知识库
- Keepalived系列一:Keepalived.conf 详解
- svn+apache+ssl快速部署