When you create a Spring Boot project and execute the mvn clean package
command, the .original
file is created in the target directory as shown below.
I tried to find out what this was.
.original
file is just a Jar or WarYes, it's just a Jar file, a War file.
Spring Boot can create an Executable Jar (War).
This format is for Jar and War that are not .original
.
.original
is not an Executable, it's just a Jar or War.
As you can see by unzipping the Jar and War and comparing the contents, the Executive Jar (War) contains the Spring Boot related classes required for execution, and the directory structure is different.
Details are explained in the official documentation. https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html
This file is created by Spring Boot Maven Plugin.
This Plugin has a goal of spring-boot: repackage
, where we create an Executable Jar (War) and rename the Jar and War originally packaged in Maven to the name .original
.
The reason why it is created even though spring-boot: repackage
is not specified like mvn clean package
is that the following settings are set in pom.xml of spring-boot-starter-parent. Is being done.
pom.xml(Excerpt)
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
repackage
is executed in the package
phase, so if you do mvn clean package
, repackage
will also be executed.
.original
fileIf you need to create an Executable Jar (War), the .original
file will always be created.
However, if you just want to create a Jar or War, you can skip creating an Executable Jar (War) with one of the following:
mvn clean package -Dspring-boot.repackage.skip=true
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
.original
fileIf the operation is to deploy the War file to the application server without using the embedded Tomcat, it does not need to be an Executable War. (Of course, you can also deploy in Executable War.)
Executable War also includes the Spring Boot classes needed to run it, as well as Maven-provided scoped libraries, so it tends to be larger than a regular War file.
Therefore, if you are doing this kind of operation, you can reduce the file size by deploying the .original
file or making the above settings so that Executable War is not created. I will.
However, I think the good thing about Spring Boot is that it can be executed quickly with the java command.
Recommended Posts