You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/01 19:10:30 UTC
(maven-toolchains-plugin) branch master updated: Inject ToolchainManagerPrivate through the constructor
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-toolchains-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new f4df8da Inject ToolchainManagerPrivate through the constructor
f4df8da is described below
commit f4df8daee101e6df9572d8a49b31c144904404d5
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Oct 1 07:51:47 2026 +0200
Inject ToolchainManagerPrivate through the constructor
---
.../org/apache/maven/plugins/toolchain/ToolchainMojo.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
index d8454f6..c106f83 100644
--- a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
+++ b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
@@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.toolchain;
+import javax.inject.Inject;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -26,7 +28,6 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
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.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
@@ -48,10 +49,7 @@ import org.apache.maven.toolchain.ToolchainPrivate;
public class ToolchainMojo extends AbstractMojo {
private static final Object LOCK = new Object();
- /**
- */
- @Component
- private ToolchainManagerPrivate toolchainManagerPrivate;
+ private final ToolchainManagerPrivate toolchainManagerPrivate;
/**
* The current build session instance. This is used for toolchain manager API calls.
@@ -70,6 +68,11 @@ public class ToolchainMojo extends AbstractMojo {
@Parameter(required = true)
private ToolchainsRequirement toolchains;
+ @Inject
+ public ToolchainMojo(ToolchainManagerPrivate toolchainManagerPrivate) {
+ this.toolchainManagerPrivate = toolchainManagerPrivate;
+ }
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (toolchains == null) {