简体   繁体   English

spring-boot-maven-plugin 的使用

[英]Use of spring-boot-maven-plugin

While creating a spring boot project I define property in pom.xml as <packaging>war</packaging> with which I can create a war and thereafter deploy the war into server maybe tomcat or WAS.在创建 Spring Boot 项目时,我将 pom.xml 中的属性定义为<packaging>war</packaging> ,我可以使用它创建一个战争,然后将战争部署到服务器中,可能是 tomcat 或 WAS。
But I came across a plugin named spring-boot-maven-plugin whose documentation states that it's use is to package executable jar or war archives and run an application in-place .但是我遇到了一个名为spring-boot-maven-plugin 的插件,其文档说明它的用途是打包可执行 jar 或 war 档案并就地运行应用程序
My query is why do we need this at all ?我的疑问是为什么我们需要这个?
If my packaging can tell me what to create and then can deploy it to run, what is the used of this plugin.如果我的打包可以告诉我要创建什么然后可以部署它运行,那么这个插件有什么用。
I am trying to understand a new project so wanted to be sure that every line makes sense我正在尝试理解一个新项目,所以想确保每一行都有意义

The maven plugin will create an "executable" archive. Maven插件将创建一个“可执行”存档。 In the case of the war packaging, you would be able to execute your app with java -jar my-app.war . 如果使用战争包装,则可以使用java -jar my-app.war执行您的应用程序。 If you intend to deploy your Spring Boot application in an existing Servlet container, then this plugin is, indeed, not necessary. 如果您打算在现有的Servlet容器中部署Spring Boot应用程序,那么确实不需要此插件。

The maven plugin does more things like running your app from the shell or creating build information. Maven插件可以执行更多操作,例如从Shell运行您的应用程序或创建构建信息。

Check the documentation 检查文件

The Spring Boot Maven Plugin provides Spring Boot support in Apache Maven, letting you package executable jar or war archives and run an application “in-place”. Spring Boot Maven 插件在 Apache Maven 中提供 Spring Boot 支持,让您可以打包可执行的 jar 或 war 档案并“就地”运行应用程序。 Refer this - https://www.javaguides.net/2019/02/use-of-spring-boot-maven-plugin-with.html参考这个 - https://www.javaguides.net/2019/02/use-of-spring-boot-maven-plugin-with.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM