mirror of https://github.com/apache/maven.git
parent
a836e898b0
commit
457bb8e000
|
@ -22,7 +22,7 @@ import org.apache.maven.api.annotations.Experimental;
|
|||
import org.apache.maven.api.cli.mvn.MavenInvoker;
|
||||
|
||||
/**
|
||||
* Local Maven invoker.
|
||||
* Forked Maven invoker.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.maven.api.cli.mvn.MavenInvokerRequest;
|
|||
import org.apache.maven.api.cli.mvn.MavenOptions;
|
||||
|
||||
/**
|
||||
* Local Maven invoker.
|
||||
* Local Maven invoker, it expects all the Maven be present in classpath.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.maven.api.cli.mvn.MavenInvokerRequest;
|
|||
import org.apache.maven.api.cli.mvn.MavenOptions;
|
||||
|
||||
/**
|
||||
* Resident invoker. Instance is shut down when this instance is closed.
|
||||
* Resident Maven invoker, similar to local. Instance is shut down when this instance is closed.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
|
|
|
@ -18,8 +18,13 @@
|
|||
*/
|
||||
package org.apache.maven.cling.invoker.mvn.forked;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.maven.api.cli.ParserException;
|
||||
|
@ -30,6 +35,9 @@ import org.apache.maven.cling.invoker.mvn.BaseMavenParser;
|
|||
import org.apache.maven.cling.invoker.mvn.CommonsCliMavenOptions;
|
||||
import org.apache.maven.cling.invoker.mvn.LayeredMavenOptions;
|
||||
|
||||
/**
|
||||
* Forked invoker that invokes Maven in a child process.
|
||||
*/
|
||||
public class DefaultForkedMavenParser extends BaseMavenParser<MavenOptions, ForkedMavenInvokerRequest>
|
||||
implements ForkedMavenParser {
|
||||
|
||||
|
@ -55,8 +63,17 @@ public class DefaultForkedMavenParser extends BaseMavenParser<MavenOptions, Fork
|
|||
|
||||
protected List<String> getJvmArguments(Path rootDirectory) {
|
||||
if (rootDirectory != null) {
|
||||
// TODO: do this
|
||||
return null;
|
||||
Path jvmConfig = rootDirectory.resolve(".mvn/jvm.config");
|
||||
if (Files.exists(jvmConfig)) {
|
||||
try {
|
||||
return Files.readAllLines(jvmConfig).stream()
|
||||
.filter(l -> !l.isBlank() && !l.startsWith("#"))
|
||||
.flatMap(l -> Arrays.stream(l.split(" ")))
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,12 @@ import org.apache.maven.api.cli.mvn.local.LocalMavenInvoker;
|
|||
import org.apache.maven.cling.invoker.ProtoLookup;
|
||||
import org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker;
|
||||
|
||||
/**
|
||||
* Local invoker implementation, when Maven CLI is being run. System uses ClassWorld launcher, and class world
|
||||
* instance is passed in via "enhanced" main method. Hence, this class expects fully setup ClassWorld via constructor.
|
||||
*
|
||||
* @see org.apache.maven.cling.MavenCling
|
||||
*/
|
||||
public class DefaultLocalMavenInvoker
|
||||
extends DefaultMavenInvoker<
|
||||
MavenOptions, MavenInvokerRequest<MavenOptions>, DefaultLocalMavenInvoker.LocalContext>
|
||||
|
|
|
@ -29,8 +29,9 @@ import org.apache.maven.cling.invoker.ProtoLookup;
|
|||
import org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker;
|
||||
|
||||
/**
|
||||
* Local invoker implementation, when Maven CLI is being run. System uses ClassWorld launcher, and class world
|
||||
* instance is passed in via "enhanced" main method. Hence, this class expects fully setup ClassWorld via constructor.
|
||||
* Local resident invoker implementation, similar to "local" but keeps Maven instance resident. This implies, that
|
||||
* things like environment, system properties, extensions etc. are loaded only once. It is caller duty to ensure
|
||||
* that subsequent call is right for the resident instance (ie no env change or different extension needed).
|
||||
*/
|
||||
public class DefaultResidentMavenInvoker
|
||||
extends DefaultMavenInvoker<
|
||||
|
|
Loading…
Reference in New Issue