春季靴子战争 [英] Spring Boot War
问题描述
我倾向于在开发过程中使用可运行的JAR,但我需要一个用于部署的WAR。
我遵循这篇关于从JAR转换为WAR Spring Boot Gradle构建的文章。
但是,现在,每次我将构建从一个构建切换到另一个构建时,我必须评论和取消构建文件的特定部分。
是否有一种更简洁的方式来处理JAR和WAR构建?解析方案
解决方案
如果你添加了spring-boot maven插件)就像jar文件一样可运行。
java -jar mywar.war
首先它是从一个嵌入式服务器开始的,您可以将相同的war部署到您的服务器,然后它不使用嵌入式服务器。
I tend to use the runnable JAR during development, but I need a WAR for deployment.
I've followed this article about converting from a JAR to WAR Spring Boot Gradle build.
However, right now, everytime I switch the builds from one to the other, I have to comment and uncomment the specific parts of the build file.
Is there a cleaner way of handling allowing for both a JAR and WAR build?
The war that gets build for deployment (that is if you added the spring-boot maven plugin) is just as runnable as a jar file.
java -jar mywar.war
And presto it starts with an embedded server, you can deploy the same war to your server and then it doesn't use an embedded server.
这篇关于春季靴子战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!