Spring boot maven plugin : goals and phase

Viewed 1223

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

2 Answers

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.

Related