diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java index e7044f54e1..586f57f7fb 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java @@ -97,7 +97,7 @@ public class FileProfileActivator else { logger.warn( "Failed to interpolate missing file location for profile activator: " + fileString - + ". Run in debug mode (-X) for more information." ); + + ", enable verbose output (-X) for more details" ); } } } diff --git a/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java b/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java index 67dca47f9b..ba8c657a4d 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java +++ b/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java @@ -128,7 +128,7 @@ class LoggingRepositoryListener } else { - logger.warn( buffer + ", enable debug logging for more details" ); + logger.warn( buffer + ", enable verbose output (-X) for more details" ); } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java index c3aed10821..d16b27d313 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java @@ -157,7 +157,8 @@ public class BuilderCommon { logger.warn( unsafePlugin.getId() ); } - logger.warn( "Enable debug to see more precisely which goals are not marked @threadSafe." ); + logger.warn( "Enable verbose output (-X) to see more precisely which goals are not marked" + + " @threadSafe." ); } logger.warn( "*****************************************************************" ); } diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java index f0eefc27e9..271e6d656c 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java @@ -623,7 +623,7 @@ public class MavenMetadataSource message = "Invalid POM for " + artifact.getId() + ", transitive dependencies (if any) will not be available" - + ", enable debug logging for more details"; + + ", enable verbose output (-X) for more details"; } if ( logger.isDebugEnabled() ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index fec2bdaf30..463edaaa1d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -46,7 +46,7 @@ public class CLIManager public static final char QUIET = 'q'; - public static final char DEBUG = 'X'; + public static final char VERBOSE = 'X'; public static final char ERRORS = 'e'; @@ -110,6 +110,11 @@ public class CLIManager public static final String COLOR = "color"; + /** This option is deprecated and may be repurposed as Java debug in a future version. + * Use {@code -X/--verbose} instead. */ + @Deprecated + public static final String DEBUG = "debug"; + protected Options options; @SuppressWarnings( "checkstyle:linelength" ) @@ -122,7 +127,7 @@ public class CLIManager options.addOption( Option.builder( Character.toString( OFFLINE ) ).longOpt( "offline" ).desc( "Work offline" ).build() ); options.addOption( Option.builder( Character.toString( VERSION ) ).longOpt( "version" ).desc( "Display version information" ).build() ); options.addOption( Option.builder( Character.toString( QUIET ) ).longOpt( "quiet" ).desc( "Quiet output - only show errors" ).build() ); - options.addOption( Option.builder( Character.toString( DEBUG ) ).longOpt( "debug" ).desc( "Produce execution debug output" ).build() ); + options.addOption( Option.builder( Character.toString( VERBOSE ) ).longOpt( "verbose" ).longOpt( "verbose" ).desc( "Produce execution verbose output" ).build() ); options.addOption( Option.builder( Character.toString( ERRORS ) ).longOpt( "errors" ).desc( "Produce execution error messages" ).build() ); options.addOption( Option.builder( Character.toString( NON_RECURSIVE ) ).longOpt( "non-recursive" ).desc( "Do not recurse into sub-projects. When used together with -pl, do not recurse into sub-projects of selected aggregators" ).build() ); options.addOption( Option.builder( Character.toString( UPDATE_SNAPSHOTS ) ).longOpt( "update-snapshots" ).desc( "Forces a check for missing releases and updated snapshots on remote repositories" ).build() ); @@ -153,6 +158,9 @@ public class CLIManager options.addOption( Option.builder( BUILDER ).longOpt( "builder" ).hasArg().desc( "The id of the build strategy to use" ).build() ); options.addOption( Option.builder( NO_TRANSFER_PROGRESS ).longOpt( "no-transfer-progress" ).desc( "Do not display transfer progress when downloading or uploading" ).build() ); options.addOption( Option.builder().longOpt( COLOR ).hasArg().optionalArg( true ).desc( "Defines the color mode of the output. Supported are 'auto', 'always', 'never'." ).build() ); + + // Deprecated + options.addOption( Option.builder().longOpt( DEBUG ).desc( "Produce execution verbose output (deprecated; only kept for backward compatibility)" ).build() ); } public CommandLine parse( String[] args ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CliRequest.java b/maven-embedder/src/main/java/org/apache/maven/cli/CliRequest.java index 7dca59169a..166d1a1ab6 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CliRequest.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CliRequest.java @@ -42,7 +42,7 @@ public class CliRequest File multiModuleProjectDirectory; - boolean debug; + boolean verbose; boolean quiet; @@ -86,9 +86,9 @@ public class CliRequest return multiModuleProjectDirectory; } - public boolean isDebug() + public boolean isVerbose() { - return debug; + return verbose; } public boolean isQuiet() diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 07a9c782ab..042ba4051d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -497,14 +497,15 @@ public class MavenCli void logging( CliRequest cliRequest ) { // LOG LEVEL - cliRequest.debug = cliRequest.commandLine.hasOption( CLIManager.DEBUG ); - cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption( CLIManager.QUIET ); - cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.ERRORS ); + cliRequest.verbose = cliRequest.commandLine.hasOption( CLIManager.VERBOSE ) + || cliRequest.commandLine.hasOption( CLIManager.DEBUG ); + cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption( CLIManager.QUIET ); + cliRequest.showErrors = cliRequest.verbose || cliRequest.commandLine.hasOption( CLIManager.ERRORS ); slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); Slf4jConfiguration slf4jConfiguration = Slf4jConfigurationFactory.getConfiguration( slf4jLoggerFactory ); - if ( cliRequest.debug ) + if ( cliRequest.verbose ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.DEBUG ); @@ -582,11 +583,17 @@ public class MavenCli MavenSlf4jWrapperFactory.class.getName(), slf4jLoggerFactory.getClass().getName() ); } } + + if ( cliRequest.commandLine.hasOption( CLIManager.DEBUG ) ) + { + slf4jLogger.warn( "The option '--debug' is deprecated and may be repurposed as Java debug" + + " in a future version. Use -X/--verbose instead." ); + } } private void version( CliRequest cliRequest ) { - if ( cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.SHOW_VERSION ) ) + if ( cliRequest.verbose || cliRequest.commandLine.hasOption( CLIManager.SHOW_VERSION ) ) { System.out.println( CLIReportingUtils.showVersion() ); } @@ -1029,12 +1036,12 @@ public class MavenCli if ( !cliRequest.showErrors ) { - slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the '{}' switch.", + slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the '{}' switch", buffer().strong( "-e" ) ); } if ( !slf4jLogger.isDebugEnabled() ) { - slf4jLogger.error( "Re-run Maven using the '{}' switch to enable full debug logging.", + slf4jLogger.error( "Re-run Maven using the '{}' switch to enable verbose output", buffer().strong( "-X" ) ); } @@ -1368,6 +1375,7 @@ public class MavenCli CommandLine commandLine = cliRequest.commandLine; String workingDirectory = cliRequest.workingDirectory; boolean quiet = cliRequest.quiet; + boolean verbose = cliRequest.verbose; request.setShowErrors( cliRequest.showErrors ); // default: false File baseDirectory = new File( workingDirectory, "" ).getAbsoluteFile(); @@ -1384,7 +1392,7 @@ public class MavenCli request.setUserProperties( cliRequest.userProperties ); request.setMultiModuleProjectDirectory( cliRequest.multiModuleProjectDirectory ); request.setPom( determinePom( commandLine, workingDirectory, baseDirectory ) ); - request.setTransferListener( determineTransferListener( quiet, commandLine, request ) ); + request.setTransferListener( determineTransferListener( quiet, verbose, commandLine, request ) ); request.setExecutionListener( determineExecutionListener() ); if ( ( request.getPom() != null ) && ( request.getPom().getParentFile() != null ) ) @@ -1593,6 +1601,7 @@ public class MavenCli } private TransferListener determineTransferListener( final boolean quiet, + final boolean verbose, final CommandLine commandLine, final MavenExecutionRequest request ) { @@ -1606,7 +1615,7 @@ public class MavenCli // If we're logging to a file then we don't want the console transfer listener as it will spew // download progress all over the place // - return getConsoleTransferListener( commandLine.hasOption( CLIManager.DEBUG ) ); + return getConsoleTransferListener( verbose ); } else { diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java index a3aad6bbb5..68e4c22e82 100644 --- a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java @@ -42,7 +42,7 @@ public class CLIManagerTest throws Exception { CommandLine cmdLine = cliManager.parse( "-X -Dx=1 -D y=2 test".split( " " ) ); - assertTrue( cmdLine.hasOption( CLIManager.DEBUG ) ); + assertTrue( cmdLine.hasOption( CLIManager.VERBOSE ) ); assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[0], is( "x=1" ) ); assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[1], is( "y=2" ) ); }