Spring boot 打jar包分离lib的正确配置方式

网友投稿 341 2023-02-15


Spring boot 打jar包分离lib的正确配置方式

前言

Springboot 打jar包分离lib,配置文件的方式,网上可以搜到的我都没试通。跟刘大神(大神没有博客,很可惜)讨论后,给出了这么一个解决方案,供大家参考。

部署环境

window 10

redhat 6.4

其他版本没有尝试,应该也是可以的

POM.xml

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.elvish

test

0.0.1-SNAPSHOT

jar

test

test

org.springframework.boot

spring-boot-starter-parent

http://1.5.10.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-thymeleaf

org.apache.maven.plugins

maven-dependency-plugin

copy-dependencies

package

copy-dependencies

target/lib

false

false

runtime

org.apache.maven.plugins

maven-jar-plugin

**/*.properties

**/*.yml

static/**

templates/**

org.springframework.boot

spring-boot-maven-plugin

ZIP

non-exists

non-exists

repackage

classes

false

org.apache.maven.plugins

maven-antrun-plugin

<exVQpFdBecutions>

package

run

target/distribution

target/distribution/tmp

${project.artifactId}-${project.version}

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.elvish

test

0.0.1-SNAPSHOT

jar

test

test

org.springframework.boot

spring-boot-starter-parent

http://1.5.10.RELEASE

UTF-8

UTF-8

1.8

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-thymeleaf

org.apache.maven.plugins

maven-dependency-plugin

copy-dependencies

package

copy-dependencies

target/lib

false

false

runtime

org.apache.maven.plugins

maven-jar-plugin

**/*.properties

**/*.yml

static/**

templates/**

org.springframework.boot

spring-boot-maven-plugin

ZIP

non-exists

non-exists

repackage

classes

false

org.apache.maven.plugins

maven-antrun-plugin

<exVQpFdBecutions>

package

run

target/distribution

target/distribution/tmp

${project.artifactId}-${project.version}

打完包后目录结构

3rd-lib

META-INF

*.yml

*.xml

*.properties

test-0.0.1-SNAPSHOT-classes.jar

test-0.0.1-SNAPSHOT-pages.jar

运行jar

java -jar -Dloader.path=.,3rd-lib test-0.0.1-SNAPSHOT-classes.jar

总结

以上所述是给大家介绍的Spring boot 打jar包分离lib的正确配置方式,希望对大家有所帮助,如果大家有任何疑问请给我留言,会及时回复大家的。在此也非常感谢大家对我们网站的支持!


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:代码实例Java IO判断目录和文件是否存在
下一篇:接口测试用例编写标准(接口测试用例编写范文)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~