boot lib分离 spring_Springboot 打jar包分离lib,配置文件正确方式

POM.xml

4.0.0

com.elvish

test

0.0.1-SNAPSHOT

jar

test2

test project for Spring Boot

org.springframework.boot

spring-boot-starter-parent

1.5.10.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-thymeleaf

test

org.apache.maven.plugins

maven-compiler-plugin

1.8

1.8

org.apache.maven.plugins

maven-dependency-plugin

copy-dependencies

package

copy-dependencies

target/lib

false

false

runtime

org.springframework.boot

spring-boot-maven-plugin

ZIP

cn.jstars

datatocloud

org.apache.maven.plugins

maven-resources-plugin

UTF-8

org.apache.maven.plugins

maven-surefire-plugin

true

true

src/main/resources

static/**

templates/**

*.yml

*.properties

*.xml

*.txt

解释说明

maven-dependency-plugin 打出项目依赖的第三方包,放在lib下面

spring-boot-maven-plugin springboot打包插件,只保留了项目运行的jar包

resources 排除了我们需要外置的文件

运行方式

将target下lib包和test.jar(运行包)以及src/main/resources下你需要外置的文件部署至服务器同一目录下,如

lib

test.jar

*.yml

*.xml

*.properties

static

templates

最终运行

java -jar -Dloader.path=.,lib test.jar

完美运行,觉得不错的,点赞一波,收藏一波吧

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值