博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Springboot 打jar包分离lib,配置文件正确方式
阅读量:4517 次
发布时间:2019-06-08

本文共 3304 字,大约阅读时间需要 11 分钟。

文章来源:

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

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

转载于:https://www.cnblogs.com/luchangjiang/p/10732365.html

你可能感兴趣的文章
APM代码学习笔记1
查看>>
[转]35岁前程序员要规划好的四件事,健康居首位
查看>>
Delphi LiveBinds组件
查看>>
pc-H5 适配方案
查看>>
简单模拟多线程Socket通信(java)
查看>>
部署和操作 Enterprise Library 加密应用程序块
查看>>
LeetCode 66. Plus One
查看>>
[HNOI2019]校园旅行
查看>>
java 内部类和静态内部类的区别
查看>>
git 常用命令
查看>>
throw er; Unhandled 'error' event Error: listen EADDRINUSE的解决方法
查看>>
2016年9月份工作知识点汇总
查看>>
NOR Flash的原理与操作
查看>>
javaweb学习总结(二十六)——jsp简单标签标签库开发(二)
查看>>
Could not open Hibernate Session for transaction, 数据库连接超时解决方法
查看>>
C# UrlEncoding
查看>>
关于Ubuntu中Could not get lock /var/lib/dpkg/lock解决方案
查看>>
sqoop安装及使用
查看>>
(10)JavaScript学习笔记 - 数组
查看>>
android4.4之后的HttpUrlConnection的实现是基于okhttp
查看>>