You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/12/30 23:22:22 UTC
[maven] branch system-line-separator created (now cccbdb8)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch system-line-separator
in repository https://gitbox.apache.org/repos/asf/maven.git.
at cccbdb8 Use system line separator wherever possible
This branch includes the following new commits:
new cccbdb8 Use system line separator wherever possible
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven] 01/01: Use system line separator wherever possible
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch system-line-separator
in repository https://gitbox.apache.org/repos/asf/maven.git
commit cccbdb80a026508612948d7d92ac347b0d13d8f1
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Dec 31 00:21:42 2020 +0100
Use system line separator wherever possible
---
.../MultipleArtifactsNotFoundException.java | 10 ++-
.../repository/MavenArtifactRepository.java | 14 ++--
.../metadata/AbstractRepositoryMetadata.java | 10 ++-
.../resolver/ArtifactResolutionRequest.java | 11 +--
.../resolver/ArtifactResolutionResult.java | 10 ++-
.../maven/exception/DefaultExceptionHandler.java | 8 +-
.../maven/plugin/PluginParameterException.java | 39 +++++-----
.../project/artifact/ActiveProjectArtifact.java | 2 +-
.../project/artifact/MavenMetadataSource.java | 10 +--
.../legacy/metadata/AbstractArtifactMetadata.java | 10 ++-
.../settings/SettingsConfigurationException.java | 4 +-
.../maven/plugin/PluginParameterExceptionTest.java | 89 +++++++++++-----------
.../main/java/org/apache/maven/cli/CLIManager.java | 6 +-
.../main/java/org/apache/maven/cli/MavenCli.java | 5 +-
.../DuplicateMojoDescriptorException.java | 4 +-
.../maven/plugin/logging/SystemStreamLog.java | 6 +-
16 files changed, 129 insertions(+), 109 deletions(-)
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
index d08dfd5..5f3303d 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
@@ -32,6 +32,8 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
public class MultipleArtifactsNotFoundException
extends ArtifactResolutionException
{
+ private static final String LS = System.lineSeparator();
+
private final List<Artifact> resolvedArtifacts;
private final List<Artifact> missingArtifacts;
@@ -86,8 +88,8 @@ public class MultipleArtifactsNotFoundException
{
StringBuilder buffer = new StringBuilder( 256 );
- buffer.append( "Missing:\n" );
- buffer.append( "----------\n" );
+ buffer.append( "Missing:" ).append( LS );
+ buffer.append( "----------" ).append( LS );
int counter = 0;
@@ -100,7 +102,7 @@ public class MultipleArtifactsNotFoundException
artifact.getDownloadUrl(), artifact.getDependencyTrail() ) );
}
- buffer.append( "----------\n" );
+ buffer.append( "----------" ).append( LS );
int size = artifacts.size();
@@ -115,7 +117,7 @@ public class MultipleArtifactsNotFoundException
buffer.append( " is" );
}
- buffer.append( " missing.\n\nfor artifact: " );
+ buffer.append( " missing." ).append( LS ).append( LS ).append( "for artifact: " );
return buffer.toString();
}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
index c330fda..33e0274 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
@@ -37,6 +37,8 @@ import org.apache.maven.repository.Proxy;
public class MavenArtifactRepository
implements ArtifactRepository
{
+ private static final String LS = System.lineSeparator();
+
private String id;
private String url;
@@ -139,25 +141,25 @@ public class MavenArtifactRepository
{
StringBuilder sb = new StringBuilder( 256 );
- sb.append( " id: " ).append( getId() ).append( '\n' );
- sb.append( " url: " ).append( getUrl() ).append( '\n' );
- sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( '\n' );
+ sb.append( " id: " ).append( getId() ).append( LS );
+ sb.append( " url: " ).append( getUrl() ).append( LS );
+ sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( LS );
if ( proxy != null )
{
- sb.append( " proxy: " ).append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( '\n' );
+ sb.append( " proxy: " ).append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( LS );
}
if ( snapshots != null )
{
sb.append( "snapshots: [enabled => " ).append( snapshots.isEnabled() );
- sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]\n" );
+ sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]" ).append( LS );
}
if ( releases != null )
{
sb.append( " releases: [enabled => " ).append( releases.isEnabled() );
- sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" );
+ sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]" );
}
return sb.toString();
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
index cc6e982..3078294 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
@@ -42,6 +42,8 @@ import java.io.Writer;
public abstract class AbstractRepositoryMetadata
implements RepositoryMetadata
{
+ private static final String LS = System.lineSeparator();
+
private Metadata metadata;
protected AbstractRepositoryMetadata( Metadata metadata )
@@ -197,10 +199,10 @@ public abstract class AbstractRepositoryMetadata
{
StringBuilder buffer = new StringBuilder( 256 );
- buffer.append( "\nRepository Metadata\n--------------------------" );
- buffer.append( "\nGroupId: " ).append( getGroupId() );
- buffer.append( "\nArtifactId: " ).append( getArtifactId() );
- buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
+ buffer.append( LS ).append( "Repository Metadata" ).append( LS ).append( "--------------------------" );
+ buffer.append( LS ).append( "GroupId: " ).append( getGroupId() );
+ buffer.append( LS ).append( "ArtifactId: " ).append( getArtifactId() );
+ buffer.append( LS ).append( "Metadata Type: " ).append( getClass().getName() );
return buffer.toString();
}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
index df17200..acf66b1 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
@@ -42,6 +42,7 @@ import org.apache.maven.settings.Server;
public class ArtifactResolutionRequest
implements RepositoryRequest
{
+ private static final String LS = System.lineSeparator();
private Artifact artifact;
@@ -234,11 +235,11 @@ public class ArtifactResolutionRequest
public String toString()
{
StringBuilder sb = new StringBuilder()
- .append( "REQUEST: " ).append( "\n" )
- .append( "artifact: " ).append( artifact ).append( "\n" )
- .append( artifactDependencies ).append( "\n" )
- .append( "localRepository: " ).append( localRepository ).append( "\n" )
- .append( "remoteRepositories: " ).append( remoteRepositories ).append( "\n" );
+ .append( "REQUEST: " ).append( LS )
+ .append( "artifact: " ).append( artifact ).append( LS )
+ .append( artifactDependencies ).append( LS )
+ .append( "localRepository: " ).append( localRepository ).append( LS )
+ .append( "remoteRepositories: " ).append( remoteRepositories );
return sb.toString();
}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
index ffae1d3..27690da 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
@@ -47,6 +47,8 @@ import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
*/
public class ArtifactResolutionResult
{
+ private static final String LS = System.lineSeparator();
+
private Artifact originatingArtifact;
private List<Artifact> missingArtifacts;
@@ -359,14 +361,14 @@ public class ArtifactResolutionResult
if ( artifacts != null )
{
int i = 1;
- sb.append( "---------\n" );
- sb.append( artifacts.size() ).append( '\n' );
+ sb.append( "---------" ).append( LS );
+ sb.append( artifacts.size() ).append( LS );
for ( Artifact a : artifacts )
{
- sb.append( i ).append( ' ' ).append( a ).append( '\n' );
+ sb.append( i ).append( ' ' ).append( a ).append( LS );
i++;
}
- sb.append( "---------\n" );
+ sb.append( "---------" );
}
return sb.toString();
diff --git a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
index ef3a452..4a5b281 100644
--- a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
+++ b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
@@ -148,9 +148,9 @@ public class DefaultExceptionHandler
return null;
}
- String message =
- "\nThe project " + result.getProjectId() + " (" + result.getPomFile() + ") has "
- + children.size() + " error" + ( children.size() == 1 ? "" : "s" );
+ String message = System.lineSeparator()
+ + "The project " + result.getProjectId() + " (" + result.getPomFile() + ") has "
+ + children.size() + " error" + ( children.size() == 1 ? "" : "s" );
return new ExceptionSummary( null, message, null, children );
}
@@ -290,7 +290,7 @@ public class DefaultExceptionHandler
}
else if ( !exceptionMessage.contains( longMessage ) )
{
- exceptionMessage = join( exceptionMessage, '\n' + longMessage );
+ exceptionMessage = join( exceptionMessage, System.lineSeparator() + longMessage );
}
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
index eaf02ec..d0a21ed 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
@@ -36,6 +36,8 @@ public class PluginParameterException
extends PluginConfigurationException
{
+ private static final String LS = System.lineSeparator();
+
private final List<Parameter> parameters;
private final MojoDescriptor mojo;
@@ -105,50 +107,53 @@ public class PluginParameterException
messageBuffer.append( "Inside the definition for plugin \'" );
messageBuffer.append( mojo.getPluginDescriptor().getArtifactId() );
- messageBuffer.append( "\', specify the following:\n\n<configuration>\n ...\n" );
+ messageBuffer.append( "\', specify the following:" ).append( LS ).append( LS );
+ messageBuffer.append( "<configuration>" ).append( LS ).append( " ..." ).append( LS );
messageBuffer.append( " <" ).append( param.getName() ).append( '>' );
if ( isArray || isCollection )
{
- messageBuffer.append( '\n' );
+ messageBuffer.append( LS );
messageBuffer.append( " <item>" );
}
else if ( isProperties )
{
- messageBuffer.append( '\n' );
- messageBuffer.append( " <property>\n" );
- messageBuffer.append( " <name>KEY</name>\n" );
+ messageBuffer.append( LS );
+ messageBuffer.append( " <property>" ).append( LS );
+ messageBuffer.append( " <name>KEY</name>" ).append( LS );
messageBuffer.append( " <value>" );
}
else if ( isMap )
{
- messageBuffer.append( '\n' );
+ messageBuffer.append( LS );
messageBuffer.append( " <KEY>" );
}
messageBuffer.append( "VALUE" );
if ( isArray || isCollection )
{
- messageBuffer.append( "</item>\n" );
+ messageBuffer.append( "</item>" ).append( LS );
messageBuffer.append( " " );
}
else if ( isProperties )
{
- messageBuffer.append( "</value>\n" );
- messageBuffer.append( " </property>\n" );
+ messageBuffer.append( "</value>" ).append( LS );
+ messageBuffer.append( " </property>" ).append( LS );
messageBuffer.append( " " );
}
else if ( isMap )
{
- messageBuffer.append( "</KEY>\n" );
+ messageBuffer.append( "</KEY>" ).append( LS );
messageBuffer.append( " " );
}
- messageBuffer.append( "</" ).append( param.getName() ).append( ">\n" );
+ messageBuffer.append( "</" ).append( param.getName() ).append( ">" ).append( LS );
messageBuffer.append( "</configuration>" );
String alias = param.getAlias();
if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) )
{
- messageBuffer.append( "\n\n-OR-\n\n<configuration>\n ...\n <" ).append( alias ).append(
- ">VALUE</" ).append( alias ).append( ">\n</configuration>\n" );
+ messageBuffer.append( LS ).append( LS ).append( "-OR-" ).append( LS ).append( LS );
+ messageBuffer.append( "<configuration>" ).append( LS ).append( " ..." ).append( LS );
+ messageBuffer.append( " <" ).append( alias ).append(
+ ">VALUE</" ).append( alias ).append( ">" ).append( LS ).append( "</configuration>" ).append( LS );
}
}
@@ -160,7 +165,7 @@ public class PluginParameterException
{
if ( param.isEditable() )
{
- messageBuffer.append( "\n\n-OR-\n\n" );
+ messageBuffer.append( LS ).append( LS ).append( "-OR-" ).append( LS ).append( LS );
}
//addParameterUsageInfo( expression, messageBuffer );
@@ -176,18 +181,18 @@ public class PluginParameterException
messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" )
.append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ':' ).append( mojo.getGoal() )
- .append( "\'\n" );
+ .append( "\'" ).append( LS );
int idx = 0;
for ( Iterator<Parameter> it = params.iterator(); it.hasNext(); idx++ )
{
Parameter param = it.next();
- messageBuffer.append( "\n[" ).append( idx ).append( "] " );
+ messageBuffer.append( LS ).append( "[" ).append( idx ).append( "] " );
decomposeParameterIntoUserInstructions( mojo, param, messageBuffer );
- messageBuffer.append( '\n' );
+ messageBuffer.append( LS );
}
return messageBuffer.toString();
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java b/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
index a1187c3..8639234 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
@@ -291,7 +291,7 @@ public class ActiveProjectArtifact
/** {@inheritDoc} */
public String toString()
{
- return "active project artifact:\n\tartifact = " + artifact + ";\n\tproject: " + project;
+ return "active project artifact[artifact: " + artifact + ", project: " + project + "]";
}
/** {@inheritDoc} */
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 4073f1d..00fbdc8 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
@@ -688,23 +688,23 @@ public class MavenMetadataSource
}
String message =
- "\n This artifact has been relocated to " + artifact.getGroupId() + ":"
- + artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n";
+ " this artifact has been relocated to " + artifact.getGroupId() + ":"
+ + artifact.getArtifactId() + ":" + artifact.getVersion() + ".";
if ( relocation.getMessage() != null )
{
- message += " " + relocation.getMessage() + "\n";
+ message += " " + relocation.getMessage();
}
if ( artifact.getDependencyTrail() != null && artifact.getDependencyTrail().size() == 1 )
{
logger.warn( "While downloading " + pomArtifact.getGroupId() + ":"
- + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );
+ + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message );
}
else
{
logger.debug( "While downloading " + pomArtifact.getGroupId() + ":"
- + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );
+ + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message );
}
}
else
diff --git a/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java b/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java
index def20e4..36bde14 100644
--- a/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java
+++ b/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java
@@ -29,6 +29,8 @@ import org.apache.maven.artifact.Artifact;
public abstract class AbstractArtifactMetadata
implements ArtifactMetadata
{
+ private static final String LS = System.lineSeparator();
+
protected Artifact artifact;
protected AbstractArtifactMetadata( Artifact artifact )
@@ -55,10 +57,10 @@ public abstract class AbstractArtifactMetadata
{
StringBuilder buffer = new StringBuilder( 256 );
- buffer.append( "\nArtifact Metadata\n--------------------------" );
- buffer.append( "\nGroupId: " ).append( getGroupId() );
- buffer.append( "\nArtifactId: " ).append( getArtifactId() );
- buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
+ buffer.append( LS ).append( "Artifact Metadata" ).append( LS ).append( "--------------------------" );
+ buffer.append( LS ).append( "GroupId: " ).append( getGroupId() );
+ buffer.append( LS ).append( "ArtifactId: " ).append( getArtifactId() );
+ buffer.append( LS ).append( "Metadata Type: " ).append( getClass().getName() );
return buffer.toString();
}
diff --git a/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java b/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
index 6fab650..7e03bfc 100644
--- a/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
+++ b/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
@@ -43,8 +43,8 @@ public class SettingsConfigurationException
public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber )
{
- super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" )
- + ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause );
+ super( message + ( lineNumber > 0 ? System.lineSeparator() + " Line: " + lineNumber : "" )
+ + ( columnNumber > 0 ? System.lineSeparator() + " Column: " + columnNumber : "" ), cause );
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
}
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
index fada72b..c13d193 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
@@ -37,6 +37,8 @@ public class PluginParameterExceptionTest
extends TestCase
{
+ private final String LS = System.lineSeparator();
+
public void testMissingRequiredStringArrayTypeParameter()
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
@@ -55,16 +57,16 @@ public class PluginParameterExceptionTest
PluginParameterException exception =
new PluginParameterException( mojoDescriptor, Collections.singletonList( parameter ) );
- assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'\n" +
- "\n" +
- "[0] Inside the definition for plugin 'artifactId', specify the following:\n" +
- "\n" +
- "<configuration>\n" +
- " ...\n" +
- " <toAddresses>\n" +
- " <item>VALUE</item>\n" +
- " </toAddresses>\n" +
- "</configuration>.\n", exception.buildDiagnosticMessage() );
+ assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'" +
+ LS + LS +
+ "[0] Inside the definition for plugin 'artifactId', specify the following:" +
+ LS + LS +
+ "<configuration>" + LS +
+ " ..." + LS +
+ " <toAddresses>" + LS +
+ " <item>VALUE</item>" + LS +
+ " </toAddresses>" + LS +
+ "</configuration>." + LS, exception.buildDiagnosticMessage() );
}
public void testMissingRequiredCollectionTypeParameter()
@@ -85,16 +87,16 @@ public class PluginParameterExceptionTest
PluginParameterException exception =
new PluginParameterException( mojoDescriptor, Collections.singletonList( parameter ) );
- assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'\n" +
- "\n" +
- "[0] Inside the definition for plugin 'artifactId', specify the following:\n" +
- "\n" +
- "<configuration>\n" +
- " ...\n" +
- " <toAddresses>\n" +
- " <item>VALUE</item>\n" +
- " </toAddresses>\n" +
- "</configuration>.\n", exception.buildDiagnosticMessage() );
+ assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'" +
+ LS + LS +
+ "[0] Inside the definition for plugin 'artifactId', specify the following:" +
+ LS + LS +
+ "<configuration>" + LS +
+ " ..." + LS +
+ " <toAddresses>" + LS +
+ " <item>VALUE</item>" + LS +
+ " </toAddresses>" + LS +
+ "</configuration>." + LS, exception.buildDiagnosticMessage() );
}
public void testMissingRequiredMapTypeParameter()
@@ -115,16 +117,16 @@ public class PluginParameterExceptionTest
PluginParameterException exception =
new PluginParameterException( mojoDescriptor, Collections.singletonList( parameter ) );
- assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'\n" +
- "\n" +
- "[0] Inside the definition for plugin 'artifactId', specify the following:\n" +
- "\n" +
- "<configuration>\n" +
- " ...\n" +
- " <toAddresses>\n" +
- " <KEY>VALUE</KEY>\n" +
- " </toAddresses>\n" +
- "</configuration>.\n", exception.buildDiagnosticMessage() );
+ assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'" +
+ LS + LS +
+ "[0] Inside the definition for plugin 'artifactId', specify the following:" +
+ LS + LS +
+ "<configuration>" + LS +
+ " ..." + LS +
+ " <toAddresses>" + LS +
+ " <KEY>VALUE</KEY>" + LS +
+ " </toAddresses>" + LS +
+ "</configuration>." + LS, exception.buildDiagnosticMessage() );
}
public void testMissingRequiredPropertiesTypeParameter()
@@ -145,20 +147,19 @@ public class PluginParameterExceptionTest
PluginParameterException exception =
new PluginParameterException( mojoDescriptor, Collections.singletonList( parameter ) );
- assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'\n" +
- "\n" +
- "[0] Inside the definition for plugin 'artifactId', specify the following:\n" +
- "\n" +
- "<configuration>\n" +
- " ...\n" +
- " <toAddresses>\n" +
- " <property>\n" +
- " <name>KEY</name>\n" +
- " <value>VALUE</value>\n" +
- " </property>\n" +
- " </toAddresses>\n" +
- "</configuration>.\n", exception.buildDiagnosticMessage() );
+ assertEquals( "One or more required plugin parameters are invalid/missing for 'goalPrefix:goal'" +
+ LS + LS +
+ "[0] Inside the definition for plugin 'artifactId', specify the following:" +
+ LS + LS +
+ "<configuration>" + LS +
+ " ..." + LS +
+ " <toAddresses>" + LS +
+ " <property>" + LS +
+ " <name>KEY</name>" + LS +
+ " <value>VALUE</value>" + LS +
+ " </property>" + LS +
+ " </toAddresses>" + LS +
+ "</configuration>." + LS, exception.buildDiagnosticMessage() );
}
-
}
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 873fc97..65f609c 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
@@ -176,8 +176,10 @@ public class CLIManager
HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp( pw, HelpFormatter.DEFAULT_WIDTH, "mvn [options] [<goal(s)>] [<phase(s)>]", "\nOptions:",
- options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, "\n", false );
+ formatter.printHelp( pw, HelpFormatter.DEFAULT_WIDTH, "mvn [options] [<goal(s)>] [<phase(s)>]",
+ System.lineSeparator() + "Options:", options,
+ HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD,
+ System.lineSeparator(), false );
pw.flush();
}
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 fd650f0..7b3728e 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
@@ -1231,7 +1231,7 @@ public class MavenCli
// There are too many ConfigurationProcessors so we don't know which one to run so report the error.
//
StringBuilder sb = new StringBuilder(
- String.format( "\nThere can only be one user supplied ConfigurationProcessor, there are %s:\n\n",
+ String.format( "%nThere can only be one user supplied ConfigurationProcessor, there are %s:%n%n",
userSuppliedConfigurationProcessorCount ) );
for ( Entry<String, ConfigurationProcessor> entry : configurationProcessors.entrySet() )
{
@@ -1239,10 +1239,9 @@ public class MavenCli
if ( !hint.equals( SettingsXmlConfigurationProcessor.HINT ) )
{
ConfigurationProcessor configurationProcessor = entry.getValue();
- sb.append( String.format( "%s\n", configurationProcessor.getClass().getName() ) );
+ sb.append( String.format( "%s%n", configurationProcessor.getClass().getName() ) );
}
}
- sb.append( "\n" );
throw new Exception( sb.toString() );
}
}
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java
index 59e0d5d..8f78e33 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java
@@ -30,8 +30,8 @@ public class DuplicateMojoDescriptorException
String newImplementation )
{
super( "Goal: " + goal + " already exists in the plugin descriptor for prefix: " + goalPrefix
- + "\nExisting implementation is: " + existingImplementation
- + "\nConflicting implementation is: " + newImplementation );
+ + System.lineSeparator() + "Existing implementation is: " + existingImplementation
+ + System.lineSeparator() + "Conflicting implementation is: " + newImplementation );
}
}
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java
index ead489a..f0fc618 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java
@@ -123,7 +123,8 @@ public class SystemStreamLog
error.printStackTrace( pWriter );
- System.err.println( "[error] " + content.toString() + "\n\n" + sWriter.toString() );
+ System.err.println( "[error] " + content.toString()
+ + System.lineSeparator() + System.lineSeparator() + sWriter.toString() );
}
/**
@@ -194,6 +195,7 @@ public class SystemStreamLog
error.printStackTrace( pWriter );
- System.out.println( "[" + prefix + "] " + content.toString() + "\n\n" + sWriter.toString() );
+ System.out.println( "[" + prefix + "] " + content.toString()
+ + System.lineSeparator() + System.lineSeparator() + sWriter.toString() );
}
}