michael-o commented on a change in pull request #34:
URL: https://github.com/apache/maven-invoker/pull/34#discussion_r776491018
##########
File path: src/main/java/org/apache/maven/shared/invoker/InvocationRequest.java
##########
@@ -763,4 +763,45 @@ public static ReactorFailureBehavior valueOfByLongOption(
String longOption )
*/
void setTimeoutInSeconds( int timeoutInSeconds );
+ /**
+ * Gets the path to the base directory of the Maven installation used to
invoke Maven.
+ *
+ * @return The path to the base directory of the Maven installation or
<code>null</code> if using the default
+ * Maven installation.
+ *
+ * @since 3.1.1
+ */
+ File getMavenHome();
+
+ /**
+ * Sets the path to the base directory of the Maven installation used to
invoke Maven. This parameter may be left
+ * unspecified to use the default Maven installation which will be
discovered by evaluating the system property
+ * <code>maven.home</code> and the environment variable
<code>M2_HOME</code>.
Review comment:
The `M2_HOME` variable is long dead. Don't use it.
##########
File path:
src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
##########
@@ -599,46 +578,61 @@ protected void setThreads( InvocationRequest request,
Commandline cli )
}
- /**
- * <p>findMavenExecutable.</p>
- *
- * @return a {@link java.io.File} object.
- * @throws
org.apache.maven.shared.invoker.CommandLineConfigurationException if any.
- * @throws java.io.IOException if any.
- */
- protected File findMavenExecutable()
- throws CommandLineConfigurationException, IOException
+ void setupMavenHome( InvocationRequest request )
{
+ if ( request.getMavenHome() != null )
+ {
+ mavenHome = request.getMavenHome();
+ }
+
if ( mavenHome == null )
{
String mavenHomeProperty = System.getProperty( "maven.home" );
+ if ( mavenHomeProperty == null && getSystemEnvVars().getProperty(
"M2_HOME" ) != null )
Review comment:
Drop this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]