mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 13:15:27 +00:00
Add a simple command option to toggle maven-like behavior, fixes #248
This commit is contained in:
@@ -267,6 +267,17 @@ public class DaemonParameters {
|
||||
.asBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if mvnd should behave as maven
|
||||
*/
|
||||
public boolean serial() {
|
||||
return value(Environment.SERIAL)
|
||||
.orSystemProperty()
|
||||
.orDefault()
|
||||
.asBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newUserDir where to change the current directory to
|
||||
* @return a new {@link DaemonParameters} with {@code userDir} set to the given {@code newUserDir}
|
||||
|
@@ -72,6 +72,11 @@ public class DefaultClient implements Client {
|
||||
}
|
||||
}
|
||||
|
||||
// Serial
|
||||
if (Environment.SERIAL.removeCommandLineOption(args) != null) {
|
||||
System.setProperty(Environment.SERIAL.getProperty(), Boolean.toString(true));
|
||||
}
|
||||
|
||||
// Batch mode
|
||||
boolean batchMode = Environment.MAVEN_BATCH_MODE.hasCommandOption(args);
|
||||
|
||||
@@ -100,6 +105,12 @@ public class DefaultClient implements Client {
|
||||
}
|
||||
|
||||
DaemonParameters parameters = new DaemonParameters();
|
||||
if (parameters.serial()) {
|
||||
System.setProperty(Environment.MVND_THREADS.getProperty(), Integer.toString(1));
|
||||
System.setProperty(Environment.MVND_BUILDER.getProperty(), "singlethreaded");
|
||||
System.setProperty(Environment.MVND_NO_BUFERING.getProperty(), Boolean.toString(true));
|
||||
}
|
||||
|
||||
int exitCode = 0;
|
||||
boolean noBuffering = batchMode || parameters.noBuffering();
|
||||
try (TerminalOutput output = new TerminalOutput(noBuffering, parameters.rollingWindowSize(), logFile)) {
|
||||
|
@@ -50,6 +50,8 @@ public enum Environment {
|
||||
STATUS(null, null, null, OptionType.VOID, Flags.OPTIONAL, "--status"),
|
||||
/** Stop all daemon instances registered in the registry specified by <code>mvnd.registry</code> */
|
||||
STOP(null, null, null, OptionType.VOID, Flags.OPTIONAL, "--stop"),
|
||||
/** Use one thread, no log buffering and the default project builder to behave like a standard maven */
|
||||
SERIAL("mvnd.serial", null, Boolean.FALSE, OptionType.BOOLEAN, Flags.OPTIONAL, "--serial"),
|
||||
|
||||
//
|
||||
// Log properties
|
||||
|
Reference in New Issue
Block a user