fix a lot of checkstyle violations for future m-checkstyle-p 2.13, as

proof of concept for misc violations suppressions strategies
This commit is contained in:
Hervé Boutemy 2014-08-19 00:17:28 +02:00
parent 1ed1d8cd3d
commit ca2b26ac5d
33 changed files with 169 additions and 117 deletions

View File

@ -104,7 +104,7 @@ private DefaultModelResolver( DefaultModelResolver original )
this.resolver = original.resolver; this.resolver = original.resolver;
this.versionRangeResolver = original.versionRangeResolver; this.versionRangeResolver = original.versionRangeResolver;
this.remoteRepositoryManager = original.remoteRepositoryManager; this.remoteRepositoryManager = original.remoteRepositoryManager;
this.repositories = new ArrayList<RemoteRepository>(original.repositories); this.repositories = new ArrayList<RemoteRepository>( original.repositories );
this.externalRepositories = original.externalRepositories; this.externalRepositories = original.externalRepositories;
this.repositoryIds = new HashSet<String>( original.repositoryIds ); this.repositoryIds = new HashSet<String>( original.repositoryIds );
} }
@ -117,14 +117,18 @@ public void addRepository( Repository repository )
} }
@Override @Override
public void addRepository(final Repository repository, boolean replace) throws InvalidRepositoryException { public void addRepository( final Repository repository, boolean replace )
throws InvalidRepositoryException
{
if ( session.isIgnoreArtifactDescriptorRepositories() ) if ( session.isIgnoreArtifactDescriptorRepositories() )
{ {
return; return;
} }
if ( !repositoryIds.add( repository.getId() ) ) { if ( !repositoryIds.add( repository.getId() ) )
if ( !replace ) { {
if ( !replace )
{
return; return;
} }
@ -138,13 +142,16 @@ public void addRepository(final Repository repository, boolean replace) throws I
remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true ); remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
} }
private static void removeMatchingRepository(Iterable<RemoteRepository> repositories, final String id) { private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
Iterables.removeIf(repositories, new Predicate<RemoteRepository>() { {
Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
{
@Override @Override
public boolean apply(RemoteRepository remoteRepository) { public boolean apply( RemoteRepository remoteRepository )
return remoteRepository.getId().equals(id); {
return remoteRepository.getId().equals( id );
} }
}); } );
} }
@Override @Override

View File

@ -1,5 +1,7 @@
// CHECKSTYLE_OFF: RegexpHeader
/** /**
* <a href="http://www.eclipse.org/aether/">Aether</a> extensions for utilizing the Maven POM and Maven repository metadata. * <a href="http://www.eclipse.org/aether/">Aether</a> extensions for utilizing the Maven POM and Maven repository
* metadata.
*/ */
package org.apache.maven.repository.internal; package org.apache.maven.repository.internal;

View File

@ -54,6 +54,7 @@ public class AbstractArtifactResolutionException
static final String LS = System.getProperty( "line.separator" ); static final String LS = System.getProperty( "line.separator" );
@SuppressWarnings( "checkstyle:parameternumber" )
protected AbstractArtifactResolutionException( String message, protected AbstractArtifactResolutionException( String message,
String groupId, String groupId,
String artifactId, String artifactId,
@ -66,6 +67,7 @@ protected AbstractArtifactResolutionException( String message,
this( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, null ); this( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, null );
} }
@SuppressWarnings( "checkstyle:parameternumber" )
protected AbstractArtifactResolutionException( String message, protected AbstractArtifactResolutionException( String message,
String groupId, String groupId,
String artifactId, String artifactId,
@ -248,6 +250,7 @@ private static String constructMessageBase( String message,
return sb.toString(); return sb.toString();
} }
@SuppressWarnings( "checkstyle:parameternumber" )
protected static String constructMissingArtifactMessage( String message, protected static String constructMissingArtifactMessage( String message,
String indentation, String indentation,
String groupId, String groupId,

View File

@ -33,7 +33,8 @@ public class ArtifactNotFoundException
{ {
private String downloadUrl; private String downloadUrl;
protected ArtifactNotFoundException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories ) protected ArtifactNotFoundException( String message, Artifact artifact,
List<ArtifactRepository> remoteRepositories )
{ {
super( message, artifact, remoteRepositories ); super( message, artifact, remoteRepositories );
} }
@ -52,6 +53,7 @@ protected ArtifactNotFoundException( String message, Artifact artifact,
cause ); cause );
} }
@SuppressWarnings( "checkstyle:parameternumber" )
public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
String classifier, List<ArtifactRepository> remoteRepositories, String classifier, List<ArtifactRepository> remoteRepositories,
String downloadUrl, List<String> path, Throwable cause ) String downloadUrl, List<String> path, Throwable cause )
@ -63,6 +65,7 @@ public ArtifactNotFoundException( String message, String groupId, String artifac
this.downloadUrl = downloadUrl; this.downloadUrl = downloadUrl;
} }
@SuppressWarnings( "checkstyle:parameternumber" )
private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
String classifier, List<ArtifactRepository> remoteRepositories, String classifier, List<ArtifactRepository> remoteRepositories,
String downloadUrl, List<String> path ) String downloadUrl, List<String> path )

View File

@ -30,6 +30,7 @@
public class ArtifactResolutionException public class ArtifactResolutionException
extends AbstractArtifactResolutionException extends AbstractArtifactResolutionException
{ {
@SuppressWarnings( "checkstyle:parameternumber" )
public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type,
String classifier, List<ArtifactRepository> remoteRepositories, String classifier, List<ArtifactRepository> remoteRepositories,
List<String> path, Throwable t ) List<String> path, Throwable t )

View File

@ -149,6 +149,7 @@ private static class StringItem
{ {
private static final String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" }; private static final String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" };
@SuppressWarnings( "checkstyle:constantname" )
private static final List<String> _QUALIFIERS = Arrays.asList( QUALIFIERS ); private static final List<String> _QUALIFIERS = Arrays.asList( QUALIFIERS );
private static final Properties ALIASES = new Properties(); private static final Properties ALIASES = new Properties();
@ -183,6 +184,7 @@ public StringItem( String value, boolean followedByDigit )
case 'm': case 'm':
value = "milestone"; value = "milestone";
break; break;
default:
} }
} }
this.value = ALIASES.getProperty( value , value ); this.value = ALIASES.getProperty( value , value );
@ -201,7 +203,8 @@ public boolean isNull()
/** /**
* Returns a comparable value for a qualifier. * Returns a comparable value for a qualifier.
* *
* This method takes into account the ordering of known qualifiers then unknown qualifiers with lexical ordering. * This method takes into account the ordering of known qualifiers then unknown qualifiers with lexical
* ordering.
* *
* just returning an Integer with the index here is faster, but requires a lot of if/then/else to check for -1 * just returning an Integer with the index here is faster, but requires a lot of if/then/else to check for -1
* or QUALIFIERS.size and then resort to lexical ordering. Most comparisons are decided by the first character, * or QUALIFIERS.size and then resort to lexical ordering. Most comparisons are decided by the first character,

View File

@ -214,7 +214,7 @@ private static Integer getNextIntegerToken( StringTokenizer tok )
} }
return Integer.valueOf( s ); return Integer.valueOf( s );
} }
catch( NoSuchElementException e ) catch ( NoSuchElementException e )
{ {
throw new NumberFormatException( "Number is invalid" ); throw new NumberFormatException( "Number is invalid" );
} }

View File

@ -131,7 +131,7 @@ public class DefaultMaven
private RepositorySystem repoSystem; private RepositorySystem repoSystem;
@Requirement( optional = true, hint = "simple" ) @Requirement( optional = true, hint = "simple" )
private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory; private LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
@Requirement @Requirement
private SettingsDecrypter settingsDecrypter; private SettingsDecrypter settingsDecrypter;
@ -188,21 +188,22 @@ public MavenExecutionResult execute( MavenExecutionRequest request )
// //
// 6) Get reactor projects looking for general POM errors // 6) Get reactor projects looking for general POM errors
// //
// 7) Create ProjectDependencyGraph using trimming which takes into account --projects and reactor mode. This ensures // 7) Create ProjectDependencyGraph using trimming which takes into account --projects and reactor mode.
// that the projects passed into the ReactorReader are only those specified. // This ensures that the projects passed into the ReactorReader are only those specified.
// //
// 8) Create ReactorReader with the getProjectMap( projects ). NOTE that getProjectMap(projects) is the code that // 8) Create ReactorReader with the getProjectMap( projects ). NOTE that getProjectMap(projects) is the code that
// checks for duplicate projects definitions in the build. Ideally this type of duplicate checking should be part of // checks for duplicate projects definitions in the build. Ideally this type of duplicate checking should be
// getting the reactor projects in 6). The duplicate checking is conflated with getProjectMap(projects). // part of getting the reactor projects in 6). The duplicate checking is conflated with getProjectMap(projects).
// //
// 9) Execute AbstractLifecycleParticipant.afterProjectsRead(session) // 9) Execute AbstractLifecycleParticipant.afterProjectsRead(session)
// //
// 10) Create ProjectDependencyGraph without trimming (as trimming was done in 7). A new topological sort is required after // 10) Create ProjectDependencyGraph without trimming (as trimming was done in 7). A new topological sort is
// the execution of 9) as the AbstractLifecycleParticipants are free to mutate the MavenProject instances, which may change // required after the execution of 9) as the AbstractLifecycleParticipants are free to mutate the MavenProject
// dependencies which can, in turn, affect the build order. // instances, which may change dependencies which can, in turn, affect the build order.
// //
// 11) Execute LifecycleStarter.start() // 11) Execute LifecycleStarter.start()
// //
@SuppressWarnings( "checkstyle:methodlength" )
private MavenExecutionResult doExecute( MavenExecutionRequest request ) private MavenExecutionResult doExecute( MavenExecutionRequest request )
{ {
request.setStartTime( new Date() ); request.setStartTime( new Date() );
@ -225,7 +226,7 @@ private MavenExecutionResult doExecute( MavenExecutionRequest request )
try try
{ {
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject> emptyList() ) ) for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject>emptyList() ) )
{ {
listener.afterSessionStart( session ); listener.afterSessionStart( session );
} }
@ -430,10 +431,11 @@ else if ( request.isUpdateSnapshots() )
if ( request.isUseLegacyLocalRepository() ) if ( request.isUseLegacyLocalRepository() )
{ {
logger.warn( "Disabling enhanced local repository: using legacy is strongly discouraged to ensure build reproducibility." ); logger.warn( "Disabling enhanced local repository: using legacy is strongly discouraged to ensure"
+ " build reproducibility." );
try try
{ {
session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( session, localRepo ) ); session.setLocalRepositoryManager( simpleLocalRepoMgrFactory.newInstance( session, localRepo ) );
} }
catch ( NoLocalRepositoryManagerException e ) catch ( NoLocalRepositoryManagerException e )
{ {
@ -677,8 +679,8 @@ private void collectProjects( List<MavenProject> projects, List<File> files, Mav
for ( ModelProblem problem : result.getProblems() ) for ( ModelProblem problem : result.getProblems() )
{ {
String location = ModelProblemUtils.formatLocation( problem, result.getProjectId() ); String loc = ModelProblemUtils.formatLocation( problem, result.getProjectId() );
logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) ); logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( loc ) ? " @ " + loc : "" ) );
} }
problems = true; problems = true;
@ -743,11 +745,11 @@ private void validateProjects( List<MavenProject> projects )
{ {
Map<String, MavenProject> projectsMap = new HashMap<String, MavenProject>(); Map<String, MavenProject> projectsMap = new HashMap<String, MavenProject>();
for ( MavenProject project : projects ) for ( MavenProject p : projects )
{ {
String projectKey = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ); String projectKey = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
projectsMap.put( projectKey, project ); projectsMap.put( projectKey, p );
} }
for ( MavenProject project : projects ) for ( MavenProject project : projects )
@ -763,7 +765,8 @@ private void validateProjects( List<MavenProject> projects )
if ( projectsMap.containsKey( pluginKey ) ) if ( projectsMap.containsKey( pluginKey ) )
{ {
logger.warn( project.getName() + " uses " + plugin.getKey() logger.warn( project.getName() + " uses " + plugin.getKey()
+ " as extensions, which is not possible within the same reactor build. This plugin was pulled from the local repository!" ); + " as extensions, which is not possible within the same reactor build. "
+ "This plugin was pulled from the local repository!" );
} }
} }
} }
@ -795,7 +798,8 @@ protected Logger getLogger()
return logger; return logger;
} }
private ProjectDependencyGraph createProjectDependencyGraph( Collection<MavenProject> projects, MavenExecutionRequest request, private ProjectDependencyGraph createProjectDependencyGraph( Collection<MavenProject> projects,
MavenExecutionRequest request,
MavenExecutionResult result, boolean trimming ) MavenExecutionResult result, boolean trimming )
{ {
ProjectDependencyGraph projectDependencyGraph = null; ProjectDependencyGraph projectDependencyGraph = null;

View File

@ -25,17 +25,11 @@
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.artifact.Artifact; import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactProperties; import org.eclipse.aether.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.ArtifactType; import org.eclipse.aether.artifact.ArtifactType;
@ -122,7 +116,7 @@ public static void toArtifacts( Collection<org.apache.maven.artifact.Artifact> a
nodeTrail.addAll( trail ); nodeTrail.addAll( trail );
nodeTrail.add( artifact.getId() ); nodeTrail.add( artifact.getId() );
if ( filter == null || filter.accept( node, Collections.<DependencyNode> emptyList() ) ) if ( filter == null || filter.accept( node, Collections.<DependencyNode>emptyList() ) )
{ {
artifact.setDependencyTrail( nodeTrail ); artifact.setDependencyTrail( nodeTrail );
artifacts.add( artifact ); artifacts.add( artifact );
@ -282,10 +276,10 @@ public static ArtifactHandler newHandler( Artifact artifact )
DefaultArtifactHandler handler = new DefaultArtifactHandler( type ); DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
handler.setExtension( artifact.getExtension() ); handler.setExtension( artifact.getExtension() );
handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) ); handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
handler.setAddedToClasspath( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" );
"" ) ) ); handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) );
handler.setIncludesDependencies( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" );
"" ) ) ); handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) );
return handler; return handler;
} }

View File

@ -34,6 +34,6 @@ protected void configure()
SessionScope scope = new SessionScope(); SessionScope scope = new SessionScope();
bindScope( SessionScoped.class, scope ); bindScope( SessionScoped.class, scope );
bind( SessionScope.class ).toInstance( scope ); bind( SessionScope.class ).toInstance( scope );
bind( MavenSession.class ).toProvider( SessionScope.<MavenSession> seededKeyProvider() ).in( scope ); bind( MavenSession.class ).toProvider( SessionScope.<MavenSession>seededKeyProvider() ).in( scope );
} }
} }

View File

@ -138,9 +138,9 @@ public String toString()
sb.append( " url: " ).append( getUrl() ).append( "\n" ); sb.append( " url: " ).append( getUrl() ).append( "\n" );
sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" ); sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" );
if( proxy != null) 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( "\n" );
} }
if ( snapshots != null ) if ( snapshots != null )

View File

@ -125,7 +125,7 @@ public boolean hasMissingArtifacts()
public List<Artifact> getMissingArtifacts() public List<Artifact> getMissingArtifacts()
{ {
return missingArtifacts == null ? Collections.<Artifact> emptyList() : missingArtifacts; return missingArtifacts == null ? Collections.<Artifact>emptyList() : missingArtifacts;
} }
public ArtifactResolutionResult addMissingArtifact( Artifact artifact ) public ArtifactResolutionResult addMissingArtifact( Artifact artifact )
@ -160,7 +160,7 @@ public boolean hasExceptions()
public List<Exception> getExceptions() public List<Exception> getExceptions()
{ {
return exceptions == null ? Collections.<Exception> emptyList() : exceptions; return exceptions == null ? Collections.<Exception>emptyList() : exceptions;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -197,7 +197,7 @@ public OverConstrainedVersionException getVersionRangeViolation( int i )
public List<Exception> getVersionRangeViolations() public List<Exception> getVersionRangeViolations()
{ {
return versionRangeViolations == null ? Collections.<Exception> emptyList() : versionRangeViolations; return versionRangeViolations == null ? Collections.<Exception>emptyList() : versionRangeViolations;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -229,7 +229,7 @@ public ArtifactResolutionException getMetadataResolutionException( int i )
public List<ArtifactResolutionException> getMetadataResolutionExceptions() public List<ArtifactResolutionException> getMetadataResolutionExceptions()
{ {
return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException> emptyList() return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException>emptyList()
: metadataResolutionExceptions; : metadataResolutionExceptions;
} }

View File

@ -24,7 +24,6 @@
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.bridge.MavenRepositorySystem; import org.apache.maven.bridge.MavenRepositorySystem;
@ -115,7 +114,7 @@ public MavenExecutionRequest populateFromSettings( MavenExecutionRequest request
{ {
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) ); request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
if(settings.getActiveProfiles().contains( rawProfile.getId() )) if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )
{ {
List<Repository> remoteRepositories = rawProfile.getRepositories(); List<Repository> remoteRepositories = rawProfile.getRepositories();
for( Repository remoteRepository : remoteRepositories ) for( Repository remoteRepository : remoteRepositories )

View File

@ -136,7 +136,8 @@ public class DefaultMavenPluginManager
private PluginDescriptorBuilder builder = new PluginDescriptorBuilder(); private PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session ) public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
RepositorySystemSession session )
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
{ {
PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session ); PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session );
@ -365,7 +366,7 @@ private void createPluginRealm( PluginDescriptor pluginDescriptor, MavenSession
List<Artifact> exposedPluginArtifacts = new ArrayList<Artifact>( nlg.getNodes().size() ); List<Artifact> exposedPluginArtifacts = new ArrayList<Artifact>( nlg.getNodes().size() );
RepositoryUtils.toArtifacts( exposedPluginArtifacts, Collections.singleton( root ), RepositoryUtils.toArtifacts( exposedPluginArtifacts, Collections.singleton( root ),
Collections.<String> emptyList(), null ); Collections.<String>emptyList(), null );
for ( Iterator<Artifact> it = exposedPluginArtifacts.iterator(); it.hasNext(); ) for ( Iterator<Artifact> it = exposedPluginArtifacts.iterator(); it.hasNext(); )
{ {
Artifact artifact = it.next(); Artifact artifact = it.next();

View File

@ -98,7 +98,7 @@ public void setCollectionErrors( List<Exception> exceptions )
public List<Exception> getResolutionErrors( Dependency dependency ) public List<Exception> getResolutionErrors( Dependency dependency )
{ {
List<Exception> errors = resolutionErrors.get( dependency ); List<Exception> errors = resolutionErrors.get( dependency );
return ( errors != null ) ? errors : Collections.<Exception> emptyList(); return ( errors != null ) ? errors : Collections.<Exception>emptyList();
} }
public void setResolutionErrors( Dependency dependency, List<Exception> errors ) public void setResolutionErrors( Dependency dependency, List<Exception> errors )

View File

@ -171,7 +171,7 @@ private ProjectBuildingResult build( File pomFile, ModelSource modelSource, Inte
modelProblems = result.getProblems(); modelProblems = result.getProblems();
initProject( project, Collections.<String, MavenProject> emptyMap(), result, initProject( project, Collections.<String, MavenProject>emptyMap(), result,
new HashMap<File, Boolean>(), projectBuildingRequest ); new HashMap<File, Boolean>(), projectBuildingRequest );
} }
else if ( projectBuildingRequest.isResolveDependencies() ) else if ( projectBuildingRequest.isResolveDependencies() )

View File

@ -846,7 +846,8 @@ public List<ArtifactRepository> getPluginArtifactRepositories()
public ArtifactRepository getDistributionManagementArtifactRepository() public ArtifactRepository getDistributionManagementArtifactRepository()
{ {
return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository() return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null )
? getSnapshotArtifactRepository()
: getReleaseArtifactRepository(); : getReleaseArtifactRepository();
} }
@ -1407,7 +1408,7 @@ public DependencyFilter getExtensionDependencyFilter()
*/ */
public void setResolvedArtifacts( Set<Artifact> artifacts ) public void setResolvedArtifacts( Set<Artifact> artifacts )
{ {
this.resolvedArtifacts = ( artifacts != null ) ? artifacts : Collections.<Artifact> emptySet(); this.resolvedArtifacts = ( artifacts != null ) ? artifacts : Collections.<Artifact>emptySet();
this.artifacts = null; this.artifacts = null;
this.artifactMap = null; this.artifactMap = null;
} }

View File

@ -91,10 +91,10 @@ public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace
this.remoteRepositoryManager = remoteRepositoryManager; this.remoteRepositoryManager = remoteRepositoryManager;
this.pomRepositories = new ArrayList<RemoteRepository>(); this.pomRepositories = new ArrayList<RemoteRepository>();
List<RemoteRepository> externalRepositories = new ArrayList<RemoteRepository>(); List<RemoteRepository> externalRepositories = new ArrayList<RemoteRepository>();
externalRepositories.addAll(repositories); externalRepositories.addAll( repositories );
this.externalRepositories = Collections.unmodifiableList(externalRepositories); this.externalRepositories = Collections.unmodifiableList( externalRepositories );
this.repositories = new ArrayList<RemoteRepository>(); this.repositories = new ArrayList<RemoteRepository>();
this.repositories.addAll(externalRepositories); this.repositories.addAll( externalRepositories );
this.repositoryMerging = repositoryMerging; this.repositoryMerging = repositoryMerging;
this.repositoryIds = new HashSet<String>(); this.repositoryIds = new HashSet<String>();
this.modelPool = modelPool; this.modelPool = modelPool;
@ -106,9 +106,9 @@ private ProjectModelResolver( ProjectModelResolver original )
this.trace = original.trace; this.trace = original.trace;
this.resolver = original.resolver; this.resolver = original.resolver;
this.remoteRepositoryManager = original.remoteRepositoryManager; this.remoteRepositoryManager = original.remoteRepositoryManager;
this.pomRepositories = new ArrayList<RemoteRepository>(original.pomRepositories); this.pomRepositories = new ArrayList<RemoteRepository>( original.pomRepositories );
this.externalRepositories = original.externalRepositories; this.externalRepositories = original.externalRepositories;
this.repositories = new ArrayList<RemoteRepository>(original.repositories); this.repositories = new ArrayList<RemoteRepository>( original.repositories );
this.repositoryMerging = original.repositoryMerging; this.repositoryMerging = original.repositoryMerging;
this.repositoryIds = new HashSet<String>( original.repositoryIds ); this.repositoryIds = new HashSet<String>( original.repositoryIds );
this.modelPool = original.modelPool; this.modelPool = original.modelPool;
@ -121,15 +121,19 @@ public void addRepository( Repository repository )
} }
@Override @Override
public void addRepository(final Repository repository, boolean replace) throws InvalidRepositoryException { public void addRepository( final Repository repository, boolean replace )
if ( !repositoryIds.add( repository.getId() ) ) { throws InvalidRepositoryException
if ( !replace ) { {
if ( !repositoryIds.add( repository.getId() ) )
{
if ( !replace )
{
return; return;
} }
//Remove any previous repository with this Id // Remove any previous repository with this Id
removeMatchingRepository(repositories, repository.getId()); removeMatchingRepository( repositories, repository.getId() );
removeMatchingRepository(pomRepositories, repository.getId()); removeMatchingRepository( pomRepositories, repository.getId() );
} }
List<RemoteRepository> newRepositories = List<RemoteRepository> newRepositories =
@ -137,7 +141,8 @@ public void addRepository(final Repository repository, boolean replace) throws I
if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) ) if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) )
{ {
repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true ); repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories,
true );
} }
else else
{ {
@ -148,13 +153,16 @@ public void addRepository(final Repository repository, boolean replace) throws I
} }
} }
private static void removeMatchingRepository(Iterable<RemoteRepository> repositories, final String id) { private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
Iterables.removeIf(repositories, new Predicate<RemoteRepository>() { {
Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
{
@Override @Override
public boolean apply(RemoteRepository remoteRepository) { public boolean apply( RemoteRepository remoteRepository )
return remoteRepository.getId().equals(id); {
return remoteRepository.getId().equals( id );
} }
}); } );
} }
public ModelResolver newCopy() public ModelResolver newCopy()

View File

@ -56,7 +56,7 @@ public List<Dependency> getDependencies()
public List<Dependency> getManagedDependencies() public List<Dependency> getManagedDependencies()
{ {
DependencyManagement depMngt = project.getDependencyManagement(); DependencyManagement depMngt = project.getDependencyManagement();
return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency> emptyList(); return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency>emptyList();
} }
static class PomArtifactHandler static class PomArtifactHandler

View File

@ -1,7 +1,5 @@
package org.apache.maven.properties.internal; package org.apache.maven.properties.internal;
import java.util.Properties;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -21,6 +19,8 @@
* under the License. * under the License.
*/ */
import java.util.Properties;
/** /**
* @since 3.2.3 * @since 3.2.3
*/ */

View File

@ -103,7 +103,7 @@ public class CLIManager
protected Options options; protected Options options;
@SuppressWarnings( "static-access" ) @SuppressWarnings( { "static-access", "checkstyle:linelength" } )
public CLIManager() public CLIManager()
{ {
options = new Options(); options = new Options();

View File

@ -38,30 +38,31 @@
*/ */
public final class CLIReportingUtils public final class CLIReportingUtils
{ {
// CHECKSTYLE_OFF: MagicNumber
public static final long MB = 1024 * 1024; public static final long MB = 1024 * 1024;
private static final long ONE_SECOND = 1000L; private static final long ONE_SECOND = 1000L;
private static final long ONE_MINUTE = 60 * ONE_SECOND; private static final long ONE_MINUTE = 60 * ONE_SECOND;
private static final long ONE_HOUR = 60 * ONE_MINUTE; private static final long ONE_HOUR = 60 * ONE_MINUTE;
private static final long ONE_DAY = 24 * ONE_HOUR; private static final long ONE_DAY = 24 * ONE_HOUR;
// CHECKSTYLE_ON: MagicNumber
public static final String BUILD_VERSION_PROPERTY = "version"; public static final String BUILD_VERSION_PROPERTY = "version";
public static String showVersion() public static String showVersion()
{ {
final String LS = System.getProperty( "line.separator" ); final String ls = System.getProperty( "line.separator" );
Properties properties = getBuildProperties(); Properties properties = getBuildProperties();
StringBuilder version = new StringBuilder(); StringBuilder version = new StringBuilder();
version.append( createMavenVersionString( properties ) ).append( LS ); version.append( createMavenVersionString( properties ) ).append( ls );
version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: "
+ System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( LS ); + System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( ls );
version.append( "Java version: " ).append( version.append( "Java version: " ).append(
System.getProperty( "java.version", "<unknown java version>" ) ).append( ", vendor: " ).append( System.getProperty( "java.version", "<unknown java version>" ) ).append( ", vendor: " ).append(
System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS ); System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( ls );
version.append( "Java home: " ).append( System.getProperty( "java.home", "<unknown java home>" ) ).append( LS ); version.append( "Java home: " ).append( System.getProperty( "java.home", "<unknown java home>" ) ).append( ls );
version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append( version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append(
System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( LS ); System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( ls );
version.append( "OS name: \"" ).append( Os.OS_NAME ).append( "\", version: \"" ).append( Os.OS_VERSION ).append( version.append( "OS name: \"" ).append( Os.OS_NAME ).append( "\", version: \"" ).append( Os.OS_VERSION ).append(
"\", arch: \"" ).append( Os.OS_ARCH ).append( "\", family: \"" ).append( Os.OS_FAMILY ).append( "\"" ); "\", arch: \"" ).append( Os.OS_ARCH ).append( "\", family: \"" ).append( Os.OS_FAMILY ).append( "\"" );
return version.toString(); return version.toString();
@ -160,8 +161,10 @@ public static String formatTimestamp( long timestamp )
offset += tz.getDSTSavings(); offset += tz.getDSTSavings();
} }
// CHECKSTYLE_OFF: MagicNumber
long m = Math.abs( ( offset / ONE_MINUTE ) % 60 ); long m = Math.abs( ( offset / ONE_MINUTE ) % 60 );
long h = Math.abs( ( offset / ONE_HOUR ) % 24 ); long h = Math.abs( ( offset / ONE_HOUR ) % 24 );
// CHECKSTYLE_ON: MagicNumber
int offsetDir = (int) Math.signum( (float) offset ); int offsetDir = (int) Math.signum( (float) offset );
char offsetSign = offsetDir >= 0 ? '+' : '-'; char offsetSign = offsetDir >= 0 ? '+' : '-';
@ -170,11 +173,13 @@ public static String formatTimestamp( long timestamp )
public static String formatDuration( long duration ) public static String formatDuration( long duration )
{ {
// CHECKSTYLE_OFF: MagicNumber
long ms = duration % 1000; long ms = duration % 1000;
long s = ( duration / ONE_SECOND ) % 60; long s = ( duration / ONE_SECOND ) % 60;
long m = ( duration / ONE_MINUTE ) % 60; long m = ( duration / ONE_MINUTE ) % 60;
long h = ( duration / ONE_HOUR ) % 24; long h = ( duration / ONE_HOUR ) % 24;
long d = duration / ONE_DAY; long d = duration / ONE_DAY;
// CHECKSTYLE_ON: MagicNumber
String format; String format;
if ( d > 0 ) if ( d > 0 )

View File

@ -100,8 +100,10 @@ public class MavenCli
public static final String THREADS_DEPRECATED = "maven.threads.experimental"; public static final String THREADS_DEPRECATED = "maven.threads.experimental";
@SuppressWarnings( "checkstyle:constantname" )
public static final String userHome = System.getProperty( "user.home" ); public static final String userHome = System.getProperty( "user.home" );
@SuppressWarnings( "checkstyle:constantname" )
public static final File userMavenConfigurationHome = new File( userHome, ".m2" ); public static final File userMavenConfigurationHome = new File( userHome, ".m2" );
public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" ); public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
@ -266,8 +268,8 @@ private void cli( CliRequest cliRequest )
throws Exception throws Exception
{ {
// //
// Parsing errors can happen during the processing of the arguments and we prefer not having to check if the logger is null // Parsing errors can happen during the processing of the arguments and we prefer not having to check if
// and construct this so we can use an SLF4J logger everywhere. // the logger is null and construct this so we can use an SLF4J logger everywhere.
// //
slf4jLogger = new Slf4jStdoutLogger(); slf4jLogger = new Slf4jStdoutLogger();
@ -498,10 +500,9 @@ private void encryption( CliRequest cliRequest )
if ( passwd == null ) if ( passwd == null )
{ {
Console cons; Console cons = System.console();
char[] password; char[] password = ( cons == null ) ? null : cons.readPassword( "Master password: " );
if ( ( cons = System.console() ) != null if ( password != null )
&& ( password = cons.readPassword( "Master password: " ) ) != null )
{ {
// Cipher uses Strings // Cipher uses Strings
passwd = String.copyValueOf( password ); passwd = String.copyValueOf( password );
@ -513,7 +514,8 @@ private void encryption( CliRequest cliRequest )
DefaultPlexusCipher cipher = new DefaultPlexusCipher(); DefaultPlexusCipher cipher = new DefaultPlexusCipher();
System.out.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); System.out.println( cipher.encryptAndDecorate( passwd,
DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) );
throw new ExitException( 0 ); throw new ExitException( 0 );
} }
@ -523,10 +525,9 @@ else if ( cliRequest.commandLine.hasOption( CLIManager.ENCRYPT_PASSWORD ) )
if ( passwd == null ) if ( passwd == null )
{ {
Console cons; Console cons = System.console();
char[] password; char[] password = ( cons == null ) ? null : cons.readPassword( "Password: " );
if ( ( cons = System.console() ) != null if ( password != null )
&& ( password = cons.readPassword( "Password: " ) ) != null )
{ {
// Cipher uses Strings // Cipher uses Strings
passwd = String.copyValueOf( password ); passwd = String.copyValueOf( password );
@ -569,7 +570,8 @@ else if ( cliRequest.commandLine.hasOption( CLIManager.ENCRYPT_PASSWORD ) )
private void repository( CliRequest cliRequest ) private void repository( CliRequest cliRequest )
throws Exception throws Exception
{ {
if ( cliRequest.commandLine.hasOption( CLIManager.LEGACY_LOCAL_REPOSITORY ) || Boolean.getBoolean( "maven.legacyLocalRepo" ) ) if ( cliRequest.commandLine.hasOption( CLIManager.LEGACY_LOCAL_REPOSITORY )
|| Boolean.getBoolean( "maven.legacyLocalRepo" ) )
{ {
cliRequest.request.setUseLegacyLocalRepository( true ); cliRequest.request.setUseLegacyLocalRepository( true );
} }
@ -687,7 +689,8 @@ private void logSummary( ExceptionSummary summary, Map<String, String> reference
{ {
String line = indent + lines[i].trim(); String line = indent + lines[i].trim();
if ( i == lines.length - 1 && ( showErrors || ( summary.getException() instanceof InternalErrorException ) ) ) if ( ( i == lines.length - 1 )
&& ( showErrors || ( summary.getException() instanceof InternalErrorException ) ) )
{ {
slf4jLogger.error( line, summary.getException() ); slf4jLogger.error( line, summary.getException() );
} }
@ -705,6 +708,7 @@ private void logSummary( ExceptionSummary summary, Map<String, String> reference
} }
} }
@SuppressWarnings( "checkstyle:methodlength" )
private void settings( CliRequest cliRequest ) private void settings( CliRequest cliRequest )
throws Exception throws Exception
{ {
@ -757,7 +761,8 @@ private void settings( CliRequest cliRequest )
eventSpyDispatcher.onEvent( settingsRequest ); eventSpyDispatcher.onEvent( settingsRequest );
slf4jLogger.debug( "Reading global settings from " slf4jLogger.debug( "Reading global settings from "
+ getSettingsLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) ); + getSettingsLocation( settingsRequest.getGlobalSettingsSource(),
settingsRequest.getGlobalSettingsFile() ) );
slf4jLogger.debug( "Reading user settings from " slf4jLogger.debug( "Reading user settings from "
+ getSettingsLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) ); + getSettingsLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
@ -1074,9 +1079,9 @@ else if ( commandLine.hasOption( CLIManager.ALSO_MAKE )
// Builder, concurrency and parallelism // Builder, concurrency and parallelism
// //
// We preserve the existing methods for builder selection which is to look for various inputs in the threading // We preserve the existing methods for builder selection which is to look for various inputs in the threading
// configuration. We don't have an easy way to allow a pluggable builder to provide its own configuration parameters // configuration. We don't have an easy way to allow a pluggable builder to provide its own configuration
// but this is sufficient for now. Ultimately we want components like Builders to provide a way to extend the command // parameters but this is sufficient for now. Ultimately we want components like Builders to provide a way to
// line to accept its own configuration parameters. // extend the command line to accept its own configuration parameters.
// //
final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS ) final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS )
? commandLine.getOptionValue( CLIManager.THREADS ) ? commandLine.getOptionValue( CLIManager.THREADS )

View File

@ -216,9 +216,9 @@ private void logStats( MavenSession session )
Runtime r = Runtime.getRuntime(); Runtime r = Runtime.getRuntime();
long MB = 1024 * 1024; long mb = 1024 * 1024;
logger.info( "Final Memory: " + ( r.totalMemory() - r.freeMemory() ) / MB + "M/" + r.totalMemory() / MB + "M" ); logger.info( "Final Memory: " + ( r.totalMemory() - r.freeMemory() ) / mb + "M/" + r.totalMemory() / mb + "M" );
} }
@Override @Override
@ -303,10 +303,12 @@ public void forkStarted( ExecutionEvent event )
} }
} }
// CHECKSTYLE_OFF: LineLength
/** /**
* <pre>&lt;&lt;&lt; mojo-artifactId:version:goal (mojo-executionId) &lt; :forked-goal @ project-artifactId &lt;&lt;&lt;</pre> * <pre>&lt;&lt;&lt; mojo-artifactId:version:goal (mojo-executionId) &lt; :forked-goal @ project-artifactId &lt;&lt;&lt;</pre>
* <pre>&lt;&lt;&lt; mojo-artifactId:version:goal (mojo-executionId) &lt; [lifecycle]phase @ project-artifactId &lt;&lt;&lt;</pre> * <pre>&lt;&lt;&lt; mojo-artifactId:version:goal (mojo-executionId) &lt; [lifecycle]phase @ project-artifactId &lt;&lt;&lt;</pre>
*/ */
// CHECKSTYLE_ON: LineLength
@Override @Override
public void forkSucceeded( ExecutionEvent event ) public void forkSucceeded( ExecutionEvent event )
{ {

View File

@ -25,7 +25,8 @@
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Use an SLF4J {@link org.slf4j.ILoggerFactory} as a backing for a Plexus {@link org.codehaus.plexus.logging.LoggerManager}, * Use an SLF4J {@link org.slf4j.ILoggerFactory} as a backing for a Plexus
* {@link org.codehaus.plexus.logging.LoggerManager},
* ignoring Plexus logger API parts that are not classical and probably not really used. * ignoring Plexus logger API parts that are not classical and probably not really used.
* *
* @author Jason van Zyl * @author Jason van Zyl

View File

@ -39,6 +39,10 @@ under the License.
<tag>HEAD</tag> <tag>HEAD</tag>
</scm> </scm>
<properties>
<checkstyle.violation.ignore>FileLength</checkstyle.violation.ignore>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>

View File

@ -1,3 +1,4 @@
// CHECKSTYLE_OFF: RegexpHeader|LineLength
/** /**
* XML reader and writer classes for Maven POM, generated from <code>maven.mdo</code> model. * XML reader and writer classes for Maven POM, generated from <code>maven.mdo</code> model.
* These classes use * These classes use

View File

@ -76,14 +76,17 @@
* Map<Object, Object> context )</code> for each model class</li> * Map<Object, Object> context )</code> for each model class</li>
* <li><code>merge<i>Classname</i>_<i>FieldName</i>( <i>Classname</i> target, <i>Classname</i> source, boolean * <li><code>merge<i>Classname</i>_<i>FieldName</i>( <i>Classname</i> target, <i>Classname</i> source, boolean
* sourceDominant, Map<Object, Object> context )</code> for each field of each model class</li> * sourceDominant, Map<Object, Object> context )</code> for each field of each model class</li>
* <li><code>Object get<i>Classname</i>Key( <i>Classname</i> <i>classname</i> )</code> for each class that is used in a list</li> * <li><code>Object get<i>Classname</i>Key( <i>Classname</i> <i>classname</i> )</code>
* for each class that is used in a list</li>
* </ul> * </ul>
* Code is written like it could be generated, with default behaviour to be overridden when necessary. * Code is written like it could be generated, with default behaviour to be overridden when necessary.
* This is particularly the case for <code>Object get<i>Classname</i>Key( <i>Classname</i> <i>classname</i> )</code> method, * This is particularly the case for <code>Object get<i>Classname</i>Key( <i>Classname</i> <i>classname</i> )</code>
* which by default return the object itself and is expected to be overridden to calculate better suited key value. * method, which by default return the object itself and is expected to be overridden to calculate better suited key
* value.
* *
* @author Benjamin Bentmann * @author Benjamin Bentmann
*/ */
@SuppressWarnings( { "checkstyle:methodname" } )
public class ModelMerger public class ModelMerger
{ {

View File

@ -1,3 +1,4 @@
// CHECKSTYLE_OFF: RegexpHeader
/** /**
* POM merger. * POM merger.
*/ */

View File

@ -1,3 +1,4 @@
// CHECKSTYLE_OFF: RegexpHeader
/** /**
* Maven POM (Project Object Model) classes, generated from <code>maven.mdo</code> model. * Maven POM (Project Object Model) classes, generated from <code>maven.mdo</code> model.
* The root class is {@link org.apache.maven.model.Model}. * The root class is {@link org.apache.maven.model.Model}.

View File

@ -317,7 +317,7 @@ public void setIntroducedDependencyArtifacts( Set<Artifact> introducedDependency
public Set<Artifact> getIntroducedDependencyArtifacts() public Set<Artifact> getIntroducedDependencyArtifacts()
{ {
return ( introducedDependencyArtifacts != null ) ? introducedDependencyArtifacts return ( introducedDependencyArtifacts != null ) ? introducedDependencyArtifacts
: Collections.<Artifact> emptySet(); : Collections.<Artifact>emptySet();
} }
public void setName( String name ) public void setName( String name )

View File

@ -180,14 +180,14 @@ private Settings readSettings( SettingsSource settingsSource, SettingsBuildingRe
} }
catch ( SettingsParseException e ) catch ( SettingsParseException e )
{ {
problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation() + ": " problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation()
+ e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
return new Settings(); return new Settings();
} }
catch ( IOException e ) catch ( IOException e )
{ {
problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation() + ": " problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation()
+ e.getMessage(), -1, -1, e ); + ": " + e.getMessage(), -1, -1, e );
return new Settings(); return new Settings();
} }
@ -196,7 +196,8 @@ private Settings readSettings( SettingsSource settingsSource, SettingsBuildingRe
return settings; return settings;
} }
private Settings interpolate( Settings settings, SettingsBuildingRequest request, SettingsProblemCollector problems ) private Settings interpolate( Settings settings, SettingsBuildingRequest request,
SettingsProblemCollector problems )
{ {
StringWriter writer = new StringWriter( 1024 * 4 ); StringWriter writer = new StringWriter( 1024 * 4 );

View File

@ -28,8 +28,10 @@
@Deprecated @Deprecated
public class RuntimeInfo public class RuntimeInfo
{ {
@SuppressWarnings( "checkstyle:constantname" )
public static final String userHome = System.getProperty( "user.home" ); public static final String userHome = System.getProperty( "user.home" );
@SuppressWarnings( "checkstyle:constantname" )
public static final File userMavenConfigurationHome = new File( userHome, ".m2" ); public static final File userMavenConfigurationHome = new File( userHome, ".m2" );
public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" ); public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );