Videos
Please dumb it down. I started a Udemy course on Spring and so far has confused me more than helped. I am so so in Java after 1.5(still in progress) semesters of it.
Is spring-boot:run a goal as I understand it to be
In fact, spring-boot is a maven plugin and run is one of its goals.
Here is the official documentation of this plugin.
In that documentation, I didn't find the default maven phase in which this goal is executed. But from the GitHub source code, I founnd out that this goal is executed in the TEST_COMPILE phase.
only specifying a phase as a target will run the other previous phases in order, not directly specifying a goal.
In fact, this is how maven works. Here is an introduction to the maven lifecycle.
Where is the configuration file for all of this located?
It is defined in your spring-boot pom parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring-boot-starter-parent.version}</version>
</parent>
As the other answer misses a bit of the information I was looking for, I thought I'd add the results of my research in case anyone else is curious. Looking in
C:\HOME_DIR.m2\repository\org\springframework\boot\spring-boot-maven-plugin\VERSION_NUMBER\META-INF\maven\plugin.xml
gives the configuration file for most of the related goals for spring with maven. Specifically, the snippet below describes how the spring-boot:run goal works.
<mojo>
<goal>run</goal>
<description>Run an executable archive application.</description>
<requiresDependencyResolution>test</requiresDependencyResolution>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>
<inheritedByDefault>true</inheritedByDefault>
<phase>validate</phase>
<executePhase>test-compile</executePhase>
<implementation>org.springframework.boot.maven.RunMojo</implementation>
<language>java</language>
<instantiationStrategy>per-lookup</instantiationStrategy>
<executionStrategy>once-per-session</executionStrategy>
<since>1.0.0</since>
<threadSafe>false</threadSafe>
...
</mojo>
Specifically, the <executePhase> tag (detailed partially at https://maven.apache.org/developers/mojo-api-specification.html), which (I believe) lets this goal execute a different phase as it's run.
I missed this detail before (it doesn't seem to be documented anywhere very well either). Either way, this explanation is satisfactory enough for me. If anyone finds better documentation for this tag, I'd appreciate a link :)
I fixed the problem adding the version of the plugin in the pom.xml, which is the same of Spring Boot's version. (and it's working since Spring Boot 2.2 until 2.7.X)
So you just have to configure your pom.xml like this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</plugin>
I fixed the problem adding a version of the plugin in the pom.xml.
<version>${project.parent.version}</version>