Browse Source

Upgrade to Maven Plugin Tools 3.15.1

Closes gh-45905
pull/45964/head
Andy Wilkinson 6 months ago
parent
commit
2c234171ef
  1. 2
      spring-boot-project/spring-boot-parent/build.gradle
  2. 6
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle
  3. 8
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractAotMojo.java
  4. 8
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java
  5. 8
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
  6. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageForkMojo.java
  7. 5
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java
  8. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageNoForkMojo.java
  9. 13
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java
  10. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessAotMojo.java
  11. 17
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessTestAotMojo.java
  12. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
  13. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java
  14. 9
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java
  15. 10
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/TestRunMojo.java

2
spring-boot-project/spring-boot-parent/build.gradle

@ -124,7 +124,7 @@ bom {
] ]
} }
} }
library("Maven Plugin Tools", "3.9.0") { library("Maven Plugin Tools", "3.15.1") {
group("org.apache.maven.plugin-tools") { group("org.apache.maven.plugin-tools") {
modules = [ modules = [
"maven-plugin-annotations" "maven-plugin-annotations"

6
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle

@ -15,12 +15,10 @@ dependencies {
compileOnly("org.apache.maven.plugin-tools:maven-plugin-annotations") compileOnly("org.apache.maven.plugin-tools:maven-plugin-annotations")
compileOnly("org.apache.maven:maven-core") { compileOnly("org.apache.maven:maven-core") {
exclude(group: "javax.annotation", module: "javax.annotation-api") exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.inject", module: "javax.inject")
} }
compileOnly("org.apache.maven:maven-plugin-api") { compileOnly("org.apache.maven:maven-plugin-api") {
exclude(group: "javax.annotation", module: "javax.annotation-api") exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api") exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
} }
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker")) dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
@ -90,6 +88,10 @@ ext {
xsdVersion = versionElements[0] + "." + versionElements[1] xsdVersion = versionElements[0] + "." + versionElements[1]
} }
tasks.named("checkCompileClasspathForProhibitedDependencies") {
permittedGroups = ["javax.inject"]
}
tasks.register("copySettingsXml", Copy) { tasks.register("copySettingsXml", Copy) {
from file("src/intTest/projects/settings.xml") from file("src/intTest/projects/settings.xml")
into layout.buildDirectory.dir("generated-resources/settings") into layout.buildDirectory.dir("generated-resources/settings")

8
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractAotMojo.java

@ -41,7 +41,6 @@ import javax.tools.ToolProvider;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
import org.apache.maven.toolchain.ToolchainManager; import org.apache.maven.toolchain.ToolchainManager;
@ -65,8 +64,7 @@ public abstract class AbstractAotMojo extends AbstractDependencyFilterMojo {
/** /**
* The toolchain manager to use to locate a custom JDK. * The toolchain manager to use to locate a custom JDK.
*/ */
@Component private final ToolchainManager toolchainManager;
private ToolchainManager toolchainManager;
/** /**
* Skip the execution. * Skip the execution.
@ -94,6 +92,10 @@ public abstract class AbstractAotMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.aot.compilerArguments") @Parameter(property = "spring-boot.aot.compilerArguments")
private String compilerArguments; private String compilerArguments;
protected AbstractAotMojo(ToolchainManager toolchainManager) {
this.toolchainManager = toolchainManager;
}
/** /**
* Return Maven execution session. * Return Maven execution session.
* @return session * @return session

8
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java

@ -31,7 +31,6 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.project.MavenProjectHelper;
@ -81,8 +80,7 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
* Maven project helper utils. * Maven project helper utils.
* @since 1.0.0 * @since 1.0.0
*/ */
@Component protected final MavenProjectHelper projectHelper;
protected MavenProjectHelper projectHelper;
/** /**
* The name of the main class. If not specified the first compiled class found that * The name of the main class. If not specified the first compiled class found that
@ -128,6 +126,10 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo
@Parameter @Parameter
private Layers layers = new Layers(); private Layers layers = new Layers();
protected AbstractPackagerMojo(MavenProjectHelper projectHelper) {
this.projectHelper = projectHelper;
}
/** /**
* Return the type of archive that should be packaged by this MOJO. * Return the type of archive that should be packaged by this MOJO.
* @return {@code null}, indicating a layout type will be chosen based on the original * @return {@code null}, indicating a layout type will be chosen based on the original

8
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

@ -33,7 +33,6 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Resource; import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.toolchain.ToolchainManager; import org.apache.maven.toolchain.ToolchainManager;
@ -76,8 +75,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* *
* @since 2.3.0 * @since 2.3.0
*/ */
@Component private final ToolchainManager toolchainManager;
private ToolchainManager toolchainManager;
/** /**
* Add maven resources to the classpath directly, this allows live in-place editing of * Add maven resources to the classpath directly, this allows live in-place editing of
@ -205,6 +203,10 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.run.skip", defaultValue = "false") @Parameter(property = "spring-boot.run.skip", defaultValue = "false")
private boolean skip; private boolean skip;
protected AbstractRunMojo(ToolchainManager toolchainManager) {
this.toolchainManager = toolchainManager;
}
@Override @Override
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (this.skip) { if (this.skip) {

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageForkMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,10 +16,13 @@
package org.springframework.boot.maven; package org.springframework.boot.maven;
import javax.inject.Inject;
import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProjectHelper;
/** /**
* Package an application into an OCI image using a buildpack, forking the lifecycle to * Package an application into an OCI image using a buildpack, forking the lifecycle to
@ -36,4 +39,9 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
@Execute(phase = LifecyclePhase.PACKAGE) @Execute(phase = LifecyclePhase.PACKAGE)
public class BuildImageForkMojo extends BuildImageMojo { public class BuildImageForkMojo extends BuildImageMojo {
@Inject
public BuildImageForkMojo(MavenProjectHelper projectHelper) {
super(projectHelper);
}
} }

5
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java

@ -33,6 +33,7 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectHelper;
import org.springframework.boot.buildpack.platform.build.AbstractBuildLog; import org.springframework.boot.buildpack.platform.build.AbstractBuildLog;
import org.springframework.boot.buildpack.platform.build.BuildLog; import org.springframework.boot.buildpack.platform.build.BuildLog;
@ -219,6 +220,10 @@ public abstract class BuildImageMojo extends AbstractPackagerMojo {
@Parameter @Parameter
private LayoutFactory layoutFactory; private LayoutFactory layoutFactory;
protected BuildImageMojo(MavenProjectHelper projectHelper) {
super(projectHelper);
}
/** /**
* Return the type of archive that should be used when building the image. * Return the type of archive that should be used when building the image.
* @return the value of the {@code layout} parameter, or {@code null} if the parameter * @return the value of the {@code layout} parameter, or {@code null} if the parameter

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageNoForkMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,9 +16,12 @@
package org.springframework.boot.maven; package org.springframework.boot.maven;
import javax.inject.Inject;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProjectHelper;
/** /**
* Package an application into an OCI image using a buildpack, but without forking the * Package an application into an OCI image using a buildpack, but without forking the
@ -33,4 +36,9 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME) requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class BuildImageNoForkMojo extends BuildImageMojo { public class BuildImageNoForkMojo extends BuildImageMojo {
@Inject
public BuildImageNoForkMojo(MavenProjectHelper projectHelper) {
super(projectHelper);
}
} }

13
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,11 +23,12 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
@ -49,8 +50,7 @@ import org.springframework.boot.loader.tools.BuildPropertiesWriter.ProjectDetail
@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) @Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
public class BuildInfoMojo extends AbstractMojo { public class BuildInfoMojo extends AbstractMojo {
@Component private final BuildContext buildContext;
private BuildContext buildContext;
/** /**
* The Maven session. * The Maven session.
@ -104,6 +104,11 @@ public class BuildInfoMojo extends AbstractMojo {
@Parameter(property = "spring-boot.build-info.skip", defaultValue = "false") @Parameter(property = "spring-boot.build-info.skip", defaultValue = "false")
private boolean skip; private boolean skip;
@Inject
public BuildInfoMojo(BuildContext buildContext) {
this.buildContext = buildContext;
}
@Override @Override
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (this.skip) { if (this.skip) {

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessAotMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,10 +21,13 @@ import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Inject;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.toolchain.ToolchainManager;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -86,6 +89,11 @@ public class ProcessAotMojo extends AbstractAotMojo {
@Parameter @Parameter
private String[] profiles; private String[] profiles;
@Inject
public ProcessAotMojo(ToolchainManager toolchainManager) {
super(toolchainManager);
}
@Override @Override
protected void executeAot() throws Exception { protected void executeAot() throws Exception {
if (this.project.getPackaging().equals("pom")) { if (this.project.getPackaging().equals("pom")) {

17
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessTestAotMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,17 +28,18 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.inject.Inject;
import org.apache.maven.RepositoryUtils; import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.toolchain.ToolchainManager;
import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.collection.CollectRequest; import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.resolution.ArtifactResult; import org.eclipse.aether.resolution.ArtifactResult;
@ -103,11 +104,13 @@ public class ProcessTestAotMojo extends AbstractAotMojo {
@Parameter(defaultValue = "${project.build.directory}/spring-aot/main/classes", required = true) @Parameter(defaultValue = "${project.build.directory}/spring-aot/main/classes", required = true)
private File generatedClasses; private File generatedClasses;
@Component private final RepositorySystem repositorySystem;
private RepositorySystem repositorySystem;
@Component @Inject
private ResolutionErrorHandler resolutionErrorHandler; public ProcessTestAotMojo(ToolchainManager toolchainManager, RepositorySystem repositorySystem) {
super(toolchainManager);
this.repositorySystem = repositorySystem;
}
@Override @Override
protected void executeAot() throws Exception { protected void executeAot() throws Exception {

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,6 +23,8 @@ import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.inject.Inject;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
@ -31,6 +33,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProjectHelper;
import org.springframework.boot.loader.tools.DefaultLaunchScript; import org.springframework.boot.loader.tools.DefaultLaunchScript;
import org.springframework.boot.loader.tools.LaunchScript; import org.springframework.boot.loader.tools.LaunchScript;
@ -179,6 +182,11 @@ public class RepackageMojo extends AbstractPackagerMojo {
@Parameter @Parameter
private LayoutFactory layoutFactory; private LayoutFactory layoutFactory;
@Inject
public RepackageMojo(MavenProjectHelper projectHelper) {
super(projectHelper);
}
/** /**
* Return the type of archive that should be packaged by this MOJO. * Return the type of archive that should be packaged by this MOJO.
* @return the value of the {@code layout} parameter, or {@code null} if the parameter * @return the value of the {@code layout} parameter, or {@code null} if the parameter

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +20,8 @@ import java.io.File;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.Execute;
@ -27,6 +29,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.toolchain.ToolchainManager;
import org.springframework.boot.loader.tools.RunProcess; import org.springframework.boot.loader.tools.RunProcess;
@ -58,6 +61,11 @@ public class RunMojo extends AbstractRunMojo {
@Parameter(property = "spring-boot.run.useTestClasspath", defaultValue = "false") @Parameter(property = "spring-boot.run.useTestClasspath", defaultValue = "false")
private Boolean useTestClasspath; private Boolean useTestClasspath;
@Inject
public RunMojo(ToolchainManager toolchainManager) {
super(toolchainManager);
}
@Override @Override
protected RunArguments resolveJvmArguments() { protected RunArguments resolveJvmArguments() {
RunArguments jvmArguments = super.resolveJvmArguments(); RunArguments jvmArguments = super.resolveJvmArguments();

9
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.inject.Inject;
import javax.management.MBeanServerConnection; import javax.management.MBeanServerConnection;
import javax.management.ReflectionException; import javax.management.ReflectionException;
import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnector;
@ -34,6 +35,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.toolchain.ToolchainManager;
import org.springframework.boot.loader.tools.RunProcess; import org.springframework.boot.loader.tools.RunProcess;
@ -91,6 +93,11 @@ public class StartMojo extends AbstractRunMojo {
@Parameter(property = "spring-boot.run.useTestClasspath", defaultValue = "false") @Parameter(property = "spring-boot.run.useTestClasspath", defaultValue = "false")
private Boolean useTestClasspath; private Boolean useTestClasspath;
@Inject
public StartMojo(ToolchainManager toolchainManager) {
super(toolchainManager);
}
@Override @Override
protected void run(JavaProcessExecutor processExecutor, File workingDirectory, List<String> args, protected void run(JavaProcessExecutor processExecutor, File workingDirectory, List<String> args,
Map<String, String> environmentVariables) throws MojoExecutionException, MojoFailureException { Map<String, String> environmentVariables) throws MojoExecutionException, MojoFailureException {

10
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/TestRunMojo.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.Execute;
@ -28,6 +30,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.toolchain.ToolchainManager;
import org.springframework.boot.loader.tools.RunProcess; import org.springframework.boot.loader.tools.RunProcess;
@ -61,6 +64,11 @@ public class TestRunMojo extends AbstractRunMojo {
@Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true) @Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true)
private File testClassesDirectory; private File testClassesDirectory;
@Inject
public TestRunMojo(ToolchainManager toolchainManager) {
super(toolchainManager);
}
@Override @Override
protected List<File> getClassesDirectories() { protected List<File> getClassesDirectories() {
ArrayList<File> classesDirectories = new ArrayList<>(super.getClassesDirectories()); ArrayList<File> classesDirectories = new ArrayList<>(super.getClassesDirectories());

Loading…
Cancel
Save