java 为什么spring boot会生成扩展名为.original的jar或war文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43641664/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:37:20  来源:igfitidea点击:

Why spring boot generates jar or war file with .original extension?

javaspring-bootjarwar

提问by Tohid Makari

Why after building spring boot app, it generates two jar or war files with .originalextension? I use spring boot maven build plugin. For example:

为什么构建spring boot应用程序后,会生成两个带有.original扩展名的jar或war文件?我使用 Spring Boot Maven 构建插件。例如:

  1. application.war
  2. application.war.original
  1. application.war
  2. application.war.original

采纳答案by Tohid Makari

The answer is that you are using repackagegoal in your spring-boot-maven-plugin. So, What it does?

答案是您repackagespring-boot-maven-plugin. 那么,它有什么作用呢?

Maven first builds your project and packages your classes and resources into a WAR (${artifactId}.war)file.

Maven 首先构建您的项目并将您的类和资源打包到一个 WAR(${artifactId}.war)文件中。

Then, repackaging happens. In this goal, all the dependencies mentioned in the pom.xml are packaged inside a new WAR (${artifactId}.war)and the previously generated war is renamed to ${artifactId}.war.original.

然后,重新包装发生。在这个目标中, pom.xml 中提到的所有依赖项都被打包到一个新的 WAR 中(${artifactId}.war),并且之前生成的 war 被重命名为${artifactId}.war.original.

回答by lane.maxwell

I assume that you're using the spring boot maven build plugin. This behavior is documented here: https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html

我假设您使用的是 spring boot maven 构建插件。此行为记录在此处https: //docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html