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

查看:37
本文介绍了一个 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,但它项目转换为 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?

附言喜欢
java -jar name.war

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

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