This question may be more related to Maven in general than Spring Boot but there is something I don't understand.
I'm using Spring boot maven plugin. It has different goals (help, repackage, start etc...)
When it comes for example to repackage goal, I can see that on official Spring documentation :
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Is this goal already bound to a specific phase of Maven's lifecycle ?
Basically what is the point of the snippet above ? Why not just using this :
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
And If I need to run repackage goal : just doing spring-boot:repackage
CodePudding user response:
Check this answer out: https://stackoverflow.com/a/56184071/10335389
You can still add spring-boot:repackage
to Maven's package command but it is just convenient to have the Jar file executable when using mvn package
.
This might be a handy resource to look at: https://www.baeldung.com/spring-boot-repackage-vs-mvn-package
CodePudding user response:
This is as explicit as it can get in the documentation, right below the example you linked, as seen here:
The example above repackages a jar or war archive that is built during the package phase of the Maven lifecycle...
Of course bonding that goal to the package
phase, means that the typical mvn clean install
will run all other goals from all other phases, up to package
(validate
, compile
, test
); unlike your spring-boot:repackage
.