From 22016982341262193d802ef51b2c236bac98464a Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Fri, 1 Jan 2021 14:09:07 +0100 Subject: [PATCH] Apply consistent log argument quoting for sigle- and multi-valued args --- .../apache/maven/graph/DefaultGraphBuilder.java | 2 +- .../org/apache/maven/project/MavenProject.java | 2 +- .../collector/DefaultProjectsSelector.java | 2 +- .../collector/MultiModuleCollectionStrategy.java | 8 ++++---- .../main/java/org/apache/maven/cli/MavenCli.java | 16 ++++++++-------- .../SettingsXmlConfigurationProcessor.java | 4 ++-- .../maven/cli/event/ExecutionEventLogger.java | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java index 14f114d640..797cbe2c51 100644 --- a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java @@ -458,7 +458,7 @@ public class DefaultGraphBuilder if ( projectsMap.containsKey( pluginKey ) ) { - LOGGER.warn( "{} uses {} as extensions, which is not possible within the same reactor build. " + LOGGER.warn( "'{}' uses '{}' as extension which is not possible within the same reactor build. " + "This plugin was pulled from the local repository!", project.getName(), plugin.getKey() ); } } diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index 94dc70aa9d..958df1e563 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -936,7 +936,7 @@ public class MavenProject int index = attachedArtifacts.indexOf( artifact ); if ( index >= 0 ) { - LOGGER.warn( "artifact {} already attached, replace previous instance", artifact ); + LOGGER.warn( "artifact '{}' already attached, replacing previous instance", artifact ); attachedArtifacts.set( index, artifact ); } else diff --git a/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java b/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java index 3776c6f0d0..d341d0ac8f 100644 --- a/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java +++ b/maven-core/src/main/java/org/apache/maven/project/collector/DefaultProjectsSelector.java @@ -74,7 +74,7 @@ public class DefaultProjectsSelector implements ProjectsSelector if ( !result.getProblems().isEmpty() && LOGGER.isWarnEnabled() ) { LOGGER.warn( "" ); - LOGGER.warn( "Some problems were encountered while building the effective model for {}", + LOGGER.warn( "Some problems were encountered while building the effective model for '{}'", result.getProject().getId() ); for ( ModelProblem problem : result.getProblems() ) diff --git a/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java b/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java index 1aab11c7d3..88c1b8c673 100644 --- a/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java +++ b/maven-core/src/main/java/org/apache/maven/project/collector/MultiModuleCollectionStrategy.java @@ -76,7 +76,7 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy } else { - logger.debug( "Multi module project collection failed: {}" + logger.debug( "Multi module project collection failed:{}" + "Detected a POM file next to a .mvn folder in a parent directory ({}). " + "Maven assumed that POM file to be the parent of the requested project ({}), but it turned " + "out that it was not. Another project collection strategy will be executed as result.", @@ -91,7 +91,7 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy if ( fallThrough ) { - logger.debug( "Multi module project collection failed: {}" + logger.debug( "Multi module project collection failed:{}" + "Detected that one of the modules of this multi module project uses another module as " + "plugin extension which still needed to be built. This is not possible within the same " + "reactor build. Another project collection strategy will be executed as result.", @@ -115,8 +115,8 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy if ( !multiModuleProjectPom.exists() ) { logger.info( "Maven detected that the requested POM file is part of a multi module project, " - + "but could not find a pom.xml file in the multi module root directory: '" - + request.getMultiModuleProjectDirectory() + "'. " ); + + "but could not find a pom.xml file in the multi module root directory '{}'.", + request.getMultiModuleProjectDirectory() ); logger.info( "The reactor is limited to all projects under: " + request.getPom().getParent() ); return request.getPom(); } 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 055e89e48a..7afe07385c 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 @@ -790,7 +790,7 @@ public class MavenCli } catch ( Exception e ) { - slf4jLogger.warn( "Failed to read extensions descriptor {}: {}", extensionsFile, e.getMessage() ); + slf4jLogger.warn( "Failed to read extensions descriptor from '{}'", extensionsFile, e ); } return Collections.emptyList(); } @@ -818,11 +818,11 @@ public class MavenCli extRealm.setParentRealm( coreRealm ); - slf4jLogger.debug( "Populating class realm {}", extRealm.getId() ); + slf4jLogger.debug( "Populating class realm '{}'", extRealm.getId() ); for ( File file : extClassPath ) { - slf4jLogger.debug( " Included {}", file ); + slf4jLogger.debug( " included '{}'", file ); extRealm.addURL( file.toURI().toURL() ); } @@ -871,7 +871,7 @@ public class MavenCli { File file = resolveFile( new File( jar ), cliRequest.workingDirectory ); - slf4jLogger.debug( " Included {}", file ); + slf4jLogger.debug( " included '{}'", file ); jars.add( file ); } @@ -1006,12 +1006,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 full debug logging.", buffer().strong( "-X" ) ); } @@ -1299,9 +1299,9 @@ public class MavenCli eventSpyDispatcher.onEvent( toolchainsRequest ); - slf4jLogger.debug( "Reading global toolchains from {}", + slf4jLogger.debug( "Reading global toolchains from '{}'", getLocation( toolchainsRequest.getGlobalToolchainsSource(), globalToolchainsFile ) ); - slf4jLogger.debug( "Reading user toolchains from {}", + slf4jLogger.debug( "Reading user toolchains from '{}'", getLocation( toolchainsRequest.getUserToolchainsSource(), userToolchainsFile ) ); ToolchainsBuildingResult toolchainsResult = toolchainsBuilder.build( toolchainsRequest ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java index 5c5ce4eaef..f57d78233e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java @@ -137,9 +137,9 @@ public class SettingsXmlConfigurationProcessor request.getEventSpyDispatcher().onEvent( settingsRequest ); } - logger.debug( "Reading global settings from {}", + logger.debug( "Reading global settings from '{}'", getLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) ); - logger.debug( "Reading user settings from {}", + logger.debug( "Reading user settings from '{}'", getLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) ); SettingsBuildingResult settingsResult = settingsBuilder.build( settingsRequest ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java index f3cd8580b6..24652d4c18 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java @@ -361,7 +361,7 @@ public class ExecutionEventLogger extends AbstractExecutionListener { if ( logger.isWarnEnabled() ) { - logger.warn( "Goal {} requires online mode for execution but Maven is currently offline, skipping", + logger.warn( "Goal '{}' requires online mode for execution but Maven is currently offline, skipping", event.getMojoExecution().getGoal() ); } }