mirror of https://github.com/apache/maven.git
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:
parent
1ed1d8cd3d
commit
ca2b26ac5d
|
@ -104,7 +104,7 @@ class DefaultModelResolver
|
|||
this.resolver = original.resolver;
|
||||
this.versionRangeResolver = original.versionRangeResolver;
|
||||
this.remoteRepositoryManager = original.remoteRepositoryManager;
|
||||
this.repositories = new ArrayList<RemoteRepository>(original.repositories);
|
||||
this.repositories = new ArrayList<RemoteRepository>( original.repositories );
|
||||
this.externalRepositories = original.externalRepositories;
|
||||
this.repositoryIds = new HashSet<String>( original.repositoryIds );
|
||||
}
|
||||
|
@ -117,14 +117,18 @@ class DefaultModelResolver
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addRepository(final Repository repository, boolean replace) throws InvalidRepositoryException {
|
||||
public void addRepository( final Repository repository, boolean replace )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
if ( session.isIgnoreArtifactDescriptorRepositories() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !repositoryIds.add( repository.getId() ) ) {
|
||||
if ( !replace ) {
|
||||
if ( !repositoryIds.add( repository.getId() ) )
|
||||
{
|
||||
if ( !replace )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -138,13 +142,16 @@ class DefaultModelResolver
|
|||
remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
|
||||
}
|
||||
|
||||
private static void removeMatchingRepository(Iterable<RemoteRepository> repositories, final String id) {
|
||||
Iterables.removeIf(repositories, new Predicate<RemoteRepository>() {
|
||||
private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
|
||||
{
|
||||
Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
|
||||
{
|
||||
@Override
|
||||
public boolean apply(RemoteRepository remoteRepository) {
|
||||
return remoteRepository.getId().equals(id);
|
||||
public boolean apply( RemoteRepository remoteRepository )
|
||||
{
|
||||
return remoteRepository.getId().equals( id );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public class AbstractArtifactResolutionException
|
|||
|
||||
static final String LS = System.getProperty( "line.separator" );
|
||||
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
protected AbstractArtifactResolutionException( String message,
|
||||
String groupId,
|
||||
String artifactId,
|
||||
|
@ -66,6 +67,7 @@ public class AbstractArtifactResolutionException
|
|||
this( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, null );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
protected AbstractArtifactResolutionException( String message,
|
||||
String groupId,
|
||||
String artifactId,
|
||||
|
@ -248,6 +250,7 @@ public class AbstractArtifactResolutionException
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
protected static String constructMissingArtifactMessage( String message,
|
||||
String indentation,
|
||||
String groupId,
|
||||
|
|
|
@ -33,7 +33,8 @@ public class ArtifactNotFoundException
|
|||
{
|
||||
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 );
|
||||
}
|
||||
|
@ -52,6 +53,7 @@ public class ArtifactNotFoundException
|
|||
cause );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
|
||||
String classifier, List<ArtifactRepository> remoteRepositories,
|
||||
String downloadUrl, List<String> path, Throwable cause )
|
||||
|
@ -63,6 +65,7 @@ public class ArtifactNotFoundException
|
|||
this.downloadUrl = downloadUrl;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
|
||||
String classifier, List<ArtifactRepository> remoteRepositories,
|
||||
String downloadUrl, List<String> path )
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
public class ArtifactResolutionException
|
||||
extends AbstractArtifactResolutionException
|
||||
{
|
||||
@SuppressWarnings( "checkstyle:parameternumber" )
|
||||
public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type,
|
||||
String classifier, List<ArtifactRepository> remoteRepositories,
|
||||
List<String> path, Throwable t )
|
||||
|
|
|
@ -149,6 +149,7 @@ public class ComparableVersion
|
|||
{
|
||||
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 Properties ALIASES = new Properties();
|
||||
|
@ -183,6 +184,7 @@ public class ComparableVersion
|
|||
case 'm':
|
||||
value = "milestone";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
this.value = ALIASES.getProperty( value , value );
|
||||
|
@ -201,7 +203,8 @@ public class ComparableVersion
|
|||
/**
|
||||
* 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
|
||||
* or QUALIFIERS.size and then resort to lexical ordering. Most comparisons are decided by the first character,
|
||||
|
|
|
@ -214,7 +214,7 @@ public class DefaultArtifactVersion
|
|||
}
|
||||
return Integer.valueOf( s );
|
||||
}
|
||||
catch( NoSuchElementException e )
|
||||
catch ( NoSuchElementException e )
|
||||
{
|
||||
throw new NumberFormatException( "Number is invalid" );
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DefaultMaven
|
|||
private RepositorySystem repoSystem;
|
||||
|
||||
@Requirement( optional = true, hint = "simple" )
|
||||
private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory;
|
||||
private LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
|
||||
|
||||
@Requirement
|
||||
private SettingsDecrypter settingsDecrypter;
|
||||
|
@ -188,21 +188,22 @@ public class DefaultMaven
|
|||
//
|
||||
// 6) Get reactor projects looking for general POM errors
|
||||
//
|
||||
// 7) Create ProjectDependencyGraph using trimming which takes into account --projects and reactor mode. This ensures
|
||||
// that the projects passed into the ReactorReader are only those specified.
|
||||
// 7) Create ProjectDependencyGraph using trimming which takes into account --projects and reactor mode.
|
||||
// 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
|
||||
// checks for duplicate projects definitions in the build. Ideally this type of duplicate checking should be part of
|
||||
// getting the reactor projects in 6). The duplicate checking is conflated with getProjectMap(projects).
|
||||
// checks for duplicate projects definitions in the build. Ideally this type of duplicate checking should be
|
||||
// part of getting the reactor projects in 6). The duplicate checking is conflated with getProjectMap(projects).
|
||||
//
|
||||
// 9) Execute AbstractLifecycleParticipant.afterProjectsRead(session)
|
||||
//
|
||||
// 10) Create ProjectDependencyGraph without trimming (as trimming was done in 7). A new topological sort is required after
|
||||
// the execution of 9) as the AbstractLifecycleParticipants are free to mutate the MavenProject instances, which may change
|
||||
// dependencies which can, in turn, affect the build order.
|
||||
//
|
||||
// 10) Create ProjectDependencyGraph without trimming (as trimming was done in 7). A new topological sort is
|
||||
// required after the execution of 9) as the AbstractLifecycleParticipants are free to mutate the MavenProject
|
||||
// instances, which may change dependencies which can, in turn, affect the build order.
|
||||
//
|
||||
// 11) Execute LifecycleStarter.start()
|
||||
//
|
||||
//
|
||||
@SuppressWarnings( "checkstyle:methodlength" )
|
||||
private MavenExecutionResult doExecute( MavenExecutionRequest request )
|
||||
{
|
||||
request.setStartTime( new Date() );
|
||||
|
@ -225,7 +226,7 @@ public class DefaultMaven
|
|||
|
||||
try
|
||||
{
|
||||
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject> emptyList() ) )
|
||||
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject>emptyList() ) )
|
||||
{
|
||||
listener.afterSessionStart( session );
|
||||
}
|
||||
|
@ -430,10 +431,11 @@ public class DefaultMaven
|
|||
|
||||
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
|
||||
{
|
||||
session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( session, localRepo ) );
|
||||
session.setLocalRepositoryManager( simpleLocalRepoMgrFactory.newInstance( session, localRepo ) );
|
||||
}
|
||||
catch ( NoLocalRepositoryManagerException e )
|
||||
{
|
||||
|
@ -677,8 +679,8 @@ public class DefaultMaven
|
|||
|
||||
for ( ModelProblem problem : result.getProblems() )
|
||||
{
|
||||
String location = ModelProblemUtils.formatLocation( problem, result.getProjectId() );
|
||||
logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) );
|
||||
String loc = ModelProblemUtils.formatLocation( problem, result.getProjectId() );
|
||||
logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( loc ) ? " @ " + loc : "" ) );
|
||||
}
|
||||
|
||||
problems = true;
|
||||
|
@ -743,11 +745,11 @@ public class DefaultMaven
|
|||
{
|
||||
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 )
|
||||
|
@ -763,7 +765,8 @@ public class DefaultMaven
|
|||
if ( projectsMap.containsKey( pluginKey ) )
|
||||
{
|
||||
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 @@ public class DefaultMaven
|
|||
return logger;
|
||||
}
|
||||
|
||||
private ProjectDependencyGraph createProjectDependencyGraph( Collection<MavenProject> projects, MavenExecutionRequest request,
|
||||
private ProjectDependencyGraph createProjectDependencyGraph( Collection<MavenProject> projects,
|
||||
MavenExecutionRequest request,
|
||||
MavenExecutionResult result, boolean trimming )
|
||||
{
|
||||
ProjectDependencyGraph projectDependencyGraph = null;
|
||||
|
|
|
@ -25,17 +25,11 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
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.ArtifactProperties;
|
||||
import org.eclipse.aether.artifact.ArtifactType;
|
||||
|
@ -122,7 +116,7 @@ public class RepositoryUtils
|
|||
nodeTrail.addAll( trail );
|
||||
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 );
|
||||
artifacts.add( artifact );
|
||||
|
@ -282,10 +276,10 @@ public class RepositoryUtils
|
|||
DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
|
||||
handler.setExtension( artifact.getExtension() );
|
||||
handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
|
||||
handler.setAddedToClasspath( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH,
|
||||
"" ) ) );
|
||||
handler.setIncludesDependencies( Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES,
|
||||
"" ) ) );
|
||||
String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" );
|
||||
handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) );
|
||||
String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" );
|
||||
handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) );
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,6 @@ public class SessionModule extends AbstractModule
|
|||
SessionScope scope = new SessionScope();
|
||||
bindScope( SessionScoped.class, scope );
|
||||
bind( SessionScope.class ).toInstance( scope );
|
||||
bind( MavenSession.class ).toProvider( SessionScope.<MavenSession> seededKeyProvider() ).in( scope );
|
||||
bind( MavenSession.class ).toProvider( SessionScope.<MavenSession>seededKeyProvider() ).in( scope );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,9 +138,9 @@ public class MavenArtifactRepository
|
|||
sb.append( " url: " ).append( getUrl() ).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 )
|
||||
|
|
|
@ -125,7 +125,7 @@ public class ArtifactResolutionResult
|
|||
|
||||
public List<Artifact> getMissingArtifacts()
|
||||
{
|
||||
return missingArtifacts == null ? Collections.<Artifact> emptyList() : missingArtifacts;
|
||||
return missingArtifacts == null ? Collections.<Artifact>emptyList() : missingArtifacts;
|
||||
}
|
||||
|
||||
public ArtifactResolutionResult addMissingArtifact( Artifact artifact )
|
||||
|
@ -160,7 +160,7 @@ public class ArtifactResolutionResult
|
|||
|
||||
public List<Exception> getExceptions()
|
||||
{
|
||||
return exceptions == null ? Collections.<Exception> emptyList() : exceptions;
|
||||
return exceptions == null ? Collections.<Exception>emptyList() : exceptions;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -197,7 +197,7 @@ public class ArtifactResolutionResult
|
|||
|
||||
public List<Exception> getVersionRangeViolations()
|
||||
{
|
||||
return versionRangeViolations == null ? Collections.<Exception> emptyList() : versionRangeViolations;
|
||||
return versionRangeViolations == null ? Collections.<Exception>emptyList() : versionRangeViolations;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -229,7 +229,7 @@ public class ArtifactResolutionResult
|
|||
|
||||
public List<ArtifactResolutionException> getMetadataResolutionExceptions()
|
||||
{
|
||||
return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException> emptyList()
|
||||
return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException>emptyList()
|
||||
: metadataResolutionExceptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.bridge.MavenRepositorySystem;
|
||||
|
@ -114,8 +113,8 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
|
||||
{
|
||||
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
|
||||
|
||||
if(settings.getActiveProfiles().contains( rawProfile.getId() ))
|
||||
|
||||
if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )
|
||||
{
|
||||
List<Repository> remoteRepositories = rawProfile.getRepositories();
|
||||
for( Repository remoteRepository : remoteRepositories )
|
||||
|
|
|
@ -136,7 +136,8 @@ public class DefaultMavenPluginManager
|
|||
|
||||
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
|
||||
{
|
||||
PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session );
|
||||
|
@ -365,7 +366,7 @@ public class DefaultMavenPluginManager
|
|||
|
||||
List<Artifact> exposedPluginArtifacts = new ArrayList<Artifact>( nlg.getNodes().size() );
|
||||
RepositoryUtils.toArtifacts( exposedPluginArtifacts, Collections.singleton( root ),
|
||||
Collections.<String> emptyList(), null );
|
||||
Collections.<String>emptyList(), null );
|
||||
for ( Iterator<Artifact> it = exposedPluginArtifacts.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = it.next();
|
||||
|
|
|
@ -98,7 +98,7 @@ class DefaultDependencyResolutionResult
|
|||
public List<Exception> getResolutionErrors( Dependency 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 )
|
||||
|
|
|
@ -171,7 +171,7 @@ public class DefaultProjectBuilder
|
|||
|
||||
modelProblems = result.getProblems();
|
||||
|
||||
initProject( project, Collections.<String, MavenProject> emptyMap(), result,
|
||||
initProject( project, Collections.<String, MavenProject>emptyMap(), result,
|
||||
new HashMap<File, Boolean>(), projectBuildingRequest );
|
||||
}
|
||||
else if ( projectBuildingRequest.isResolveDependencies() )
|
||||
|
|
|
@ -846,7 +846,8 @@ public class MavenProject
|
|||
|
||||
public ArtifactRepository getDistributionManagementArtifactRepository()
|
||||
{
|
||||
return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository()
|
||||
return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null )
|
||||
? getSnapshotArtifactRepository()
|
||||
: getReleaseArtifactRepository();
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1408,7 @@ public class MavenProject
|
|||
*/
|
||||
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.artifactMap = null;
|
||||
}
|
||||
|
|
|
@ -91,10 +91,10 @@ class ProjectModelResolver
|
|||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.pomRepositories = new ArrayList<RemoteRepository>();
|
||||
List<RemoteRepository> externalRepositories = new ArrayList<RemoteRepository>();
|
||||
externalRepositories.addAll(repositories);
|
||||
this.externalRepositories = Collections.unmodifiableList(externalRepositories);
|
||||
externalRepositories.addAll( repositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
||||
this.repositories = new ArrayList<RemoteRepository>();
|
||||
this.repositories.addAll(externalRepositories);
|
||||
this.repositories.addAll( externalRepositories );
|
||||
this.repositoryMerging = repositoryMerging;
|
||||
this.repositoryIds = new HashSet<String>();
|
||||
this.modelPool = modelPool;
|
||||
|
@ -106,9 +106,9 @@ class ProjectModelResolver
|
|||
this.trace = original.trace;
|
||||
this.resolver = original.resolver;
|
||||
this.remoteRepositoryManager = original.remoteRepositoryManager;
|
||||
this.pomRepositories = new ArrayList<RemoteRepository>(original.pomRepositories);
|
||||
this.pomRepositories = new ArrayList<RemoteRepository>( original.pomRepositories );
|
||||
this.externalRepositories = original.externalRepositories;
|
||||
this.repositories = new ArrayList<RemoteRepository>(original.repositories);
|
||||
this.repositories = new ArrayList<RemoteRepository>( original.repositories );
|
||||
this.repositoryMerging = original.repositoryMerging;
|
||||
this.repositoryIds = new HashSet<String>( original.repositoryIds );
|
||||
this.modelPool = original.modelPool;
|
||||
|
@ -121,15 +121,19 @@ class ProjectModelResolver
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addRepository(final Repository repository, boolean replace) throws InvalidRepositoryException {
|
||||
if ( !repositoryIds.add( repository.getId() ) ) {
|
||||
if ( !replace ) {
|
||||
public void addRepository( final Repository repository, boolean replace )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
if ( !repositoryIds.add( repository.getId() ) )
|
||||
{
|
||||
if ( !replace )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Remove any previous repository with this Id
|
||||
removeMatchingRepository(repositories, repository.getId());
|
||||
removeMatchingRepository(pomRepositories, repository.getId());
|
||||
// Remove any previous repository with this Id
|
||||
removeMatchingRepository( repositories, repository.getId() );
|
||||
removeMatchingRepository( pomRepositories, repository.getId() );
|
||||
}
|
||||
|
||||
List<RemoteRepository> newRepositories =
|
||||
|
@ -137,7 +141,8 @@ class ProjectModelResolver
|
|||
|
||||
if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) )
|
||||
{
|
||||
repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
|
||||
repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories,
|
||||
true );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -148,13 +153,16 @@ class ProjectModelResolver
|
|||
}
|
||||
}
|
||||
|
||||
private static void removeMatchingRepository(Iterable<RemoteRepository> repositories, final String id) {
|
||||
Iterables.removeIf(repositories, new Predicate<RemoteRepository>() {
|
||||
private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
|
||||
{
|
||||
Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
|
||||
{
|
||||
@Override
|
||||
public boolean apply(RemoteRepository remoteRepository) {
|
||||
return remoteRepository.getId().equals(id);
|
||||
public boolean apply( RemoteRepository remoteRepository )
|
||||
{
|
||||
return remoteRepository.getId().equals( id );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
public ModelResolver newCopy()
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ProjectArtifact
|
|||
public List<Dependency> getManagedDependencies()
|
||||
{
|
||||
DependencyManagement depMngt = project.getDependencyManagement();
|
||||
return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency> emptyList();
|
||||
return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency>emptyList();
|
||||
}
|
||||
|
||||
static class PomArtifactHandler
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.apache.maven.properties.internal;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -21,6 +19,8 @@ import java.util.Properties;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @since 3.2.3
|
||||
*/
|
||||
|
|
|
@ -103,7 +103,7 @@ public class CLIManager
|
|||
|
||||
protected Options options;
|
||||
|
||||
@SuppressWarnings( "static-access" )
|
||||
@SuppressWarnings( { "static-access", "checkstyle:linelength" } )
|
||||
public CLIManager()
|
||||
{
|
||||
options = new Options();
|
||||
|
|
|
@ -38,30 +38,31 @@ import org.slf4j.Logger;
|
|||
*/
|
||||
public final class CLIReportingUtils
|
||||
{
|
||||
|
||||
// CHECKSTYLE_OFF: MagicNumber
|
||||
public static final long MB = 1024 * 1024;
|
||||
|
||||
private static final long ONE_SECOND = 1000L;
|
||||
private static final long ONE_MINUTE = 60 * ONE_SECOND;
|
||||
private static final long ONE_HOUR = 60 * ONE_MINUTE;
|
||||
private static final long ONE_DAY = 24 * ONE_HOUR;
|
||||
// CHECKSTYLE_ON: MagicNumber
|
||||
|
||||
public static final String BUILD_VERSION_PROPERTY = "version";
|
||||
|
||||
public static String showVersion()
|
||||
{
|
||||
final String LS = System.getProperty( "line.separator" );
|
||||
final String ls = System.getProperty( "line.separator" );
|
||||
Properties properties = getBuildProperties();
|
||||
StringBuilder version = new StringBuilder();
|
||||
version.append( createMavenVersionString( properties ) ).append( LS );
|
||||
version.append( createMavenVersionString( properties ) ).append( ls );
|
||||
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(
|
||||
System.getProperty( "java.version", "<unknown java version>" ) ).append( ", vendor: " ).append(
|
||||
System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS );
|
||||
version.append( "Java home: " ).append( System.getProperty( "java.home", "<unknown java home>" ) ).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( "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(
|
||||
"\", arch: \"" ).append( Os.OS_ARCH ).append( "\", family: \"" ).append( Os.OS_FAMILY ).append( "\"" );
|
||||
return version.toString();
|
||||
|
@ -160,8 +161,10 @@ public final class CLIReportingUtils
|
|||
offset += tz.getDSTSavings();
|
||||
}
|
||||
|
||||
// CHECKSTYLE_OFF: MagicNumber
|
||||
long m = Math.abs( ( offset / ONE_MINUTE ) % 60 );
|
||||
long h = Math.abs( ( offset / ONE_HOUR ) % 24 );
|
||||
// CHECKSTYLE_ON: MagicNumber
|
||||
|
||||
int offsetDir = (int) Math.signum( (float) offset );
|
||||
char offsetSign = offsetDir >= 0 ? '+' : '-';
|
||||
|
@ -170,11 +173,13 @@ public final class CLIReportingUtils
|
|||
|
||||
public static String formatDuration( long duration )
|
||||
{
|
||||
// CHECKSTYLE_OFF: MagicNumber
|
||||
long ms = duration % 1000;
|
||||
long s = ( duration / ONE_SECOND ) % 60;
|
||||
long m = ( duration / ONE_MINUTE ) % 60;
|
||||
long h = ( duration / ONE_HOUR ) % 24;
|
||||
long d = duration / ONE_DAY;
|
||||
// CHECKSTYLE_ON: MagicNumber
|
||||
|
||||
String format;
|
||||
if ( d > 0 )
|
||||
|
|
|
@ -100,8 +100,10 @@ public class MavenCli
|
|||
|
||||
public static final String THREADS_DEPRECATED = "maven.threads.experimental";
|
||||
|
||||
@SuppressWarnings( "checkstyle:constantname" )
|
||||
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 DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
|
||||
|
@ -266,8 +268,8 @@ public class MavenCli
|
|||
throws Exception
|
||||
{
|
||||
//
|
||||
// Parsing errors can happen during the processing of the arguments and we prefer not having to check if the logger is null
|
||||
// and construct this so we can use an SLF4J logger everywhere.
|
||||
// Parsing errors can happen during the processing of the arguments and we prefer not having to check if
|
||||
// the logger is null and construct this so we can use an SLF4J logger everywhere.
|
||||
//
|
||||
slf4jLogger = new Slf4jStdoutLogger();
|
||||
|
||||
|
@ -498,10 +500,9 @@ public class MavenCli
|
|||
|
||||
if ( passwd == null )
|
||||
{
|
||||
Console cons;
|
||||
char[] password;
|
||||
if ( ( cons = System.console() ) != null
|
||||
&& ( password = cons.readPassword( "Master password: " ) ) != null )
|
||||
Console cons = System.console();
|
||||
char[] password = ( cons == null ) ? null : cons.readPassword( "Master password: " );
|
||||
if ( password != null )
|
||||
{
|
||||
// Cipher uses Strings
|
||||
passwd = String.copyValueOf( password );
|
||||
|
@ -513,7 +514,8 @@ public class MavenCli
|
|||
|
||||
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 );
|
||||
}
|
||||
|
@ -523,10 +525,9 @@ public class MavenCli
|
|||
|
||||
if ( passwd == null )
|
||||
{
|
||||
Console cons;
|
||||
char[] password;
|
||||
if ( ( cons = System.console() ) != null
|
||||
&& ( password = cons.readPassword( "Password: " ) ) != null )
|
||||
Console cons = System.console();
|
||||
char[] password = ( cons == null ) ? null : cons.readPassword( "Password: " );
|
||||
if ( password != null )
|
||||
{
|
||||
// Cipher uses Strings
|
||||
passwd = String.copyValueOf( password );
|
||||
|
@ -569,7 +570,8 @@ public class MavenCli
|
|||
private void repository( CliRequest cliRequest )
|
||||
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 );
|
||||
}
|
||||
|
@ -687,7 +689,8 @@ public class MavenCli
|
|||
{
|
||||
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() );
|
||||
}
|
||||
|
@ -705,6 +708,7 @@ public class MavenCli
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:methodlength" )
|
||||
private void settings( CliRequest cliRequest )
|
||||
throws Exception
|
||||
{
|
||||
|
@ -757,7 +761,8 @@ public class MavenCli
|
|||
eventSpyDispatcher.onEvent( settingsRequest );
|
||||
|
||||
slf4jLogger.debug( "Reading global settings from "
|
||||
+ getSettingsLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) );
|
||||
+ getSettingsLocation( settingsRequest.getGlobalSettingsSource(),
|
||||
settingsRequest.getGlobalSettingsFile() ) );
|
||||
slf4jLogger.debug( "Reading user settings from "
|
||||
+ getSettingsLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
|
||||
|
||||
|
@ -1074,9 +1079,9 @@ public class MavenCli
|
|||
// Builder, concurrency and parallelism
|
||||
//
|
||||
// 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
|
||||
// but this is sufficient for now. Ultimately we want components like Builders to provide a way to extend the command
|
||||
// line to accept its own configuration parameters.
|
||||
// configuration. We don't have an easy way to allow a pluggable builder to provide its own configuration
|
||||
// parameters but this is sufficient for now. Ultimately we want components like Builders to provide a way to
|
||||
// extend the command line to accept its own configuration parameters.
|
||||
//
|
||||
final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS )
|
||||
? commandLine.getOptionValue( CLIManager.THREADS )
|
||||
|
|
|
@ -216,9 +216,9 @@ public class ExecutionEventLogger
|
|||
|
||||
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
|
||||
|
@ -303,10 +303,12 @@ public class ExecutionEventLogger
|
|||
}
|
||||
}
|
||||
|
||||
// CHECKSTYLE_OFF: LineLength
|
||||
/**
|
||||
* <pre><<< mojo-artifactId:version:goal (mojo-executionId) < :forked-goal @ project-artifactId <<<</pre>
|
||||
* <pre><<< mojo-artifactId:version:goal (mojo-executionId) < [lifecycle]phase @ project-artifactId <<<</pre>
|
||||
*/
|
||||
// CHECKSTYLE_ON: LineLength
|
||||
@Override
|
||||
public void forkSucceeded( ExecutionEvent event )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.slf4j.ILoggerFactory;
|
|||
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.
|
||||
*
|
||||
* @author Jason van Zyl
|
||||
|
|
|
@ -39,6 +39,10 @@ under the License.
|
|||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<checkstyle.violation.ignore>FileLength</checkstyle.violation.ignore>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// CHECKSTYLE_OFF: RegexpHeader|LineLength
|
||||
/**
|
||||
* XML reader and writer classes for Maven POM, generated from <code>maven.mdo</code> model.
|
||||
* These classes use
|
||||
|
|
|
@ -76,14 +76,17 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
* 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
|
||||
* 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>
|
||||
* 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,
|
||||
* which by default return the object itself and is expected to be overridden to calculate better suited key value.
|
||||
* This is particularly the case for <code>Object get<i>Classname</i>Key( <i>Classname</i> <i>classname</i> )</code>
|
||||
* method, which by default return the object itself and is expected to be overridden to calculate better suited key
|
||||
* value.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
@SuppressWarnings( { "checkstyle:methodname" } )
|
||||
public class ModelMerger
|
||||
{
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// CHECKSTYLE_OFF: RegexpHeader
|
||||
/**
|
||||
* POM merger.
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// CHECKSTYLE_OFF: RegexpHeader
|
||||
/**
|
||||
* Maven POM (Project Object Model) classes, generated from <code>maven.mdo</code> model.
|
||||
* The root class is {@link org.apache.maven.model.Model}.
|
||||
|
|
|
@ -317,7 +317,7 @@ public class PluginDescriptor
|
|||
public Set<Artifact> getIntroducedDependencyArtifacts()
|
||||
{
|
||||
return ( introducedDependencyArtifacts != null ) ? introducedDependencyArtifacts
|
||||
: Collections.<Artifact> emptySet();
|
||||
: Collections.<Artifact>emptySet();
|
||||
}
|
||||
|
||||
public void setName( String name )
|
||||
|
|
|
@ -180,14 +180,14 @@ public class DefaultSettingsBuilder
|
|||
}
|
||||
catch ( SettingsParseException e )
|
||||
{
|
||||
problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation() + ": "
|
||||
+ e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
|
||||
problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation()
|
||||
+ ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
|
||||
return new Settings();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation() + ": "
|
||||
+ e.getMessage(), -1, -1, e );
|
||||
problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation()
|
||||
+ ": " + e.getMessage(), -1, -1, e );
|
||||
return new Settings();
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,8 @@ public class DefaultSettingsBuilder
|
|||
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 );
|
||||
|
||||
|
|
|
@ -28,8 +28,10 @@ import java.io.File;
|
|||
@Deprecated
|
||||
public class RuntimeInfo
|
||||
{
|
||||
@SuppressWarnings( "checkstyle:constantname" )
|
||||
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 DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
|
||||
|
|
Loading…
Reference in New Issue