Polish "Add toolchains support for Spring Boot Maven Plugin"

See gh-18732
This commit is contained in:
Stephane Nicoll
2019-12-26 11:42:16 +01:00
parent eede16ff0a
commit e7f45d8a34
5 changed files with 27 additions and 21 deletions

View File

@@ -25,7 +25,10 @@
</executions>
<configuration>
<toolchains>
<jdk/>
<jdk>
<version>42</version>
<vendor>test</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>

View File

@@ -1,6 +1,10 @@
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>42</version>
<vendor>test</vendor>
</provides>
<configuration>
<jdkHome>jdkHome</jdkHome>
</configuration>

View File

@@ -1,3 +1,2 @@
def file = new File(basedir, "build.log")
return file.text.contains("The Maven Toolchains is awesome!")

View File

@@ -69,6 +69,20 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
/**
* The current Maven session. This is used for toolchain manager API calls.
* @since 2.3.0
*/
@Parameter(defaultValue = "${session}", readonly = true)
private MavenSession session;
/**
* The toolchain manager to use to locate a custom JDK.
* @since 2.3.0
*/
@Component
private ToolchainManager toolchainManager;
/**
* Add maven resources to the classpath directly, this allows live in-place editing of
* resources. Duplicate resources are removed from {@code target/classes} to prevent
@@ -209,20 +223,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.run.skip", defaultValue = "false")
private boolean skip;
/**
* The Maven Session Object.
* @since 2.2.1
*/
@Parameter(defaultValue = "${session}", readonly = true)
private MavenSession session;
/**
* The toolchain manager to use.
* @since 2.2.1
*/
@Component
private ToolchainManager toolchainManager;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (this.skip) {