一个Spring Boot项目,同时部署到JAR或WAR [英] One Spring Boot project, deploy to both JAR or WAR

查看:123
本文介绍了一个Spring Boot项目,同时部署到JAR或WAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在不更改pom.xml或应用程序源的情况下将单个Spring Boot项目打包到JAR和WAR中?

Is there a way to have a single Spring Boot project be packagable into both JAR and WAR without changing the pom.xml or the application source?

我已阅读将Spring Boot JAR应用程序转换为WAR a>,但是它转换为WAR,并且无法打包为JAR.

I've read Converting a Spring Boot JAR Application to a WAR, but it converts the project to WAR and it loses the ability to be packaged as JAR.

我不希望mvn package同时执行.我想要的是类似mvn i-want-a-jar的东西,它将项目打包为JAR.或者,我可以运行mvn i-want-a-war,它将项目打包为WAR.

I don't expect mvn package to do both. What I want is something like mvn i-want-a-jar and it would package the project as JAR. Or I could run mvn i-want-a-war and it would package the project as WAR.

这可能吗?

推荐答案

可执行的WAR文件怎么了?那不是您真正需要的吗?

What's wrong with a WAR file that's executable? Isn't that what you really need?

P.S.喜欢
java -jar name.war

P.S. like
java -jar name.war

这篇关于一个Spring Boot项目,同时部署到JAR或WAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆