efe77d8fa0
Bootstrap build. Related: RHEL-70855 Related: RHEL-70860 Related: RHEL-71057
57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
From 1b66b3d5d6cd1e502012e4dbd68f978dacc1312f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
|
Date: Sat, 7 May 2022 18:13:02 +0200
|
|
Subject: [PATCH 1/2] Simple implementation of toolchains
|
|
https://github.com/fedora-java/xmvn/issues/142
|
|
|
|
---
|
|
.../fedoraproject/xmvn/mojo/JavadocMojo.java | 17 ++++++++++++++++-
|
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
|
|
index b2cd41fd..2b06e702 100644
|
|
--- a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
|
|
+++ b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java
|
|
@@ -45,6 +45,8 @@ import org.apache.maven.project.DependencyResolutionRequest;
|
|
import org.apache.maven.project.DependencyResolutionResult;
|
|
import org.apache.maven.project.MavenProject;
|
|
import org.apache.maven.project.ProjectDependenciesResolver;
|
|
+import org.apache.maven.toolchain.Toolchain;
|
|
+import org.apache.maven.toolchain.ToolchainManager;
|
|
import org.codehaus.plexus.logging.Logger;
|
|
import org.codehaus.plexus.util.StringUtils;
|
|
import org.eclipse.aether.util.filter.AndDependencyFilter;
|
|
@@ -69,6 +71,9 @@ public class JavadocMojo
|
|
@Component
|
|
private Configurator confugurator;
|
|
|
|
+ @Component
|
|
+ private ToolchainManager toolchainManager;
|
|
+
|
|
@Parameter( defaultValue = "${session}", readonly = true )
|
|
private MavenSession session;
|
|
|
|
@@ -161,8 +166,18 @@ public class JavadocMojo
|
|
public void execute()
|
|
throws MojoExecutionException, MojoFailureException
|
|
{
|
|
+ String javadocTool = null;
|
|
+ Toolchain tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
|
|
+ if ( tc != null )
|
|
+ {
|
|
+ javadocTool = tc.findTool( "javadoc" );
|
|
+ }
|
|
Path javadocExecutable;
|
|
- if ( System.getenv().containsKey( "JAVA_HOME" ) )
|
|
+ if ( javadocTool != null && !javadocTool.isEmpty() )
|
|
+ {
|
|
+ javadocExecutable = Paths.get( javadocTool );
|
|
+ }
|
|
+ else if ( System.getenv().containsKey( "JAVA_HOME" ) )
|
|
{
|
|
javadocExecutable = Paths.get( System.getenv( "JAVA_HOME" ) ) //
|
|
.resolve( "bin" ) //
|
|
--
|
|
2.47.1
|
|
|