mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-10-15 14:50:54 +00:00
Fixes --verbose/--debug options (fixes #1208)
This commit is contained in:
@@ -248,10 +248,10 @@ public class DefaultClient implements Client {
|
||||
|
||||
boolean version = Environment.MAVEN_VERSION.hasCommandLineOption(args);
|
||||
boolean showVersion = Environment.MAVEN_SHOW_VERSION.hasCommandLineOption(args);
|
||||
boolean debug = Environment.MAVEN_DEBUG.hasCommandLineOption(args);
|
||||
boolean verbose = Environment.MAVEN_VERBOSE.hasCommandLineOption(args);
|
||||
|
||||
// Print version if needed
|
||||
if (version || showVersion || debug) {
|
||||
if (version || showVersion || verbose) {
|
||||
// Print mvnd version
|
||||
BuildProperties buildProperties = BuildProperties.getInstance();
|
||||
final String mvndVersionString = "Apache Maven Daemon (mvnd) " + buildProperties.getVersion() + " "
|
||||
@@ -337,6 +337,10 @@ public class DefaultClient implements Client {
|
||||
.or(() -> Optional.ofNullable(parameters.mavenRepoLocal()).map(Path::toString));
|
||||
repo.ifPresent(r -> Environment.MAVEN_REPO_LOCAL.addCommandLineOption(args, r));
|
||||
|
||||
if (Environment.MVND_DEBUG.removeCommandLineOption(args) != null) {
|
||||
System.setProperty(Environment.MVND_DEBUG.getProperty(), "true");
|
||||
}
|
||||
|
||||
String width = Optional.ofNullable(Environment.MVND_TERMINAL_WIDTH.removeCommandLineOption(args))
|
||||
.orElseGet(() -> {
|
||||
int w = output.getTerminalWidth();
|
||||
|
@@ -338,6 +338,13 @@ public class DaemonParameters {
|
||||
.asBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if maven should be executed in debug mode.
|
||||
*/
|
||||
public boolean debug() {
|
||||
return value(Environment.MVND_DEBUG).orSystemProperty().orDefault().asBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if mvnd should behave as maven
|
||||
@@ -354,6 +361,10 @@ public class DaemonParameters {
|
||||
return derive(b -> b.put(Environment.USER_DIR, newUserDir));
|
||||
}
|
||||
|
||||
public DaemonParameters debug(boolean debug) {
|
||||
return derive(b -> b.put(Environment.MVND_DEBUG, debug));
|
||||
}
|
||||
|
||||
public DaemonParameters withJdkJavaOpts(String opts, boolean before) {
|
||||
String org = this.properties.getOrDefault(Environment.JDK_JAVA_OPTIONS.getProperty(), "");
|
||||
return derive(b -> b.put(
|
||||
|
@@ -103,8 +103,8 @@ public enum Environment {
|
||||
MAVEN_LOG_FILE(null, null, null, OptionType.PATH, Flags.INTERNAL, "mvn:-l", "mvn:--log-file"),
|
||||
/** Batch mode */
|
||||
MAVEN_BATCH_MODE(null, null, null, OptionType.BOOLEAN, Flags.INTERNAL, "mvn:-B", "mvn:--batch-mode"),
|
||||
/** Debug */
|
||||
MAVEN_DEBUG(null, null, null, OptionType.BOOLEAN, Flags.INTERNAL, "mvn:-X", "mvn:--verbose"),
|
||||
/** Verbose */
|
||||
MAVEN_VERBOSE(null, null, null, OptionType.BOOLEAN, Flags.INTERNAL, "mvn:-X", "mvn:--verbose"),
|
||||
/** Version */
|
||||
MAVEN_VERSION(null, null, null, OptionType.BOOLEAN, Flags.INTERNAL, "mvn:-v", "mvn:-version", "mvn:--version"),
|
||||
/** Show version */
|
||||
@@ -166,7 +166,7 @@ public enum Environment {
|
||||
* <code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000</code>; otherwise the debug argument is
|
||||
* not passed to the daemon.
|
||||
*/
|
||||
MVND_DEBUG("mvnd.debug", null, Boolean.FALSE, OptionType.BOOLEAN, Flags.DISCRIMINATING),
|
||||
MVND_DEBUG("mvnd.debug", null, Boolean.FALSE, OptionType.BOOLEAN, Flags.DISCRIMINATING, "mvn:--debug"),
|
||||
/**
|
||||
* The tcp address used to launch the debug mode. Defaults to <code>8000</code>, which is similar to
|
||||
* <code>localhost:8000</code>. In order to remote debug from a different computer, you need to allow
|
||||
|
@@ -218,7 +218,7 @@ _mvnd()
|
||||
|
||||
local mvnd_opts="-1"
|
||||
local mvnd_long_opts="--color|--completion|--diag|--purge|--serial|--status|--stop"
|
||||
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.coreExtensionsExclude|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.noModelCache|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketConnectTimeout|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home"
|
||||
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmaven.style.color|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.coreExtensionsExclude|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.noModelCache|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketConnectTimeout|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Duser.dir|-Duser.home"
|
||||
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}"
|
||||
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}"
|
||||
|
||||
|
Reference in New Issue
Block a user