Cleanup checkstyle reported errors.

This commit is contained in:
Karl Heinz Marbaise 2015-09-26 20:19:16 +02:00
parent b03062d2a0
commit d4e299acec
5 changed files with 94 additions and 73 deletions

View File

@ -22,7 +22,9 @@
import org.apache.maven.artifact.UnknownRepositoryLayoutException; import org.apache.maven.artifact.UnknownRepositoryLayoutException;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
/** @author jdcasey */ /**
* @author jdcasey
*/
public interface ArtifactRepositoryFactory public interface ArtifactRepositoryFactory
{ {
String ROLE = ArtifactRepositoryFactory.class.getName(); String ROLE = ArtifactRepositoryFactory.class.getName();
@ -36,7 +38,8 @@ ArtifactRepositoryLayout getLayout( String layoutId )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
@Deprecated @Deprecated
ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId,
boolean uniqueVersion )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
@ -47,7 +50,8 @@ ArtifactRepository createArtifactRepository( String id, String url, String layou
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases );
void setGlobalUpdatePolicy( String snapshotPolicy ); void setGlobalUpdatePolicy( String snapshotPolicy );

View File

@ -46,7 +46,8 @@ public interface ArtifactResolver
// USED BY SUREFIRE, DEPENDENCY PLUGIN // USED BY SUREFIRE, DEPENDENCY PLUGIN
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
ArtifactRepository localRepository, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
@ -54,7 +55,8 @@ ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact
// USED BY MAVEN ASSEMBLY PLUGIN // USED BY MAVEN ASSEMBLY PLUGIN
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
@ -62,7 +64,8 @@ ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact
// USED BY MAVEN ASSEMBLY PLUGIN // USED BY MAVEN ASSEMBLY PLUGIN
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
@ -70,13 +73,15 @@ ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact
// USED BY INVOKER PLUGIN // USED BY INVOKER PLUGIN
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactMetadataSource source ) ArtifactRepository localRepository, ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter, ArtifactMetadataSource source, ArtifactFilter filter,
@ -84,7 +89,8 @@ ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively(
Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactMetadataSource source, ArtifactRepository localRepository, ArtifactMetadataSource source,
List<ResolutionListener> listeners ) List<ResolutionListener> listeners )

View File

@ -114,9 +114,9 @@ public void restrictRange( Artifact artifact, Artifact replacement, VersionRange
/** /**
* The logic used here used to be a copy of the logic used in the DefaultArtifactCollector, and this method was * The logic used here used to be a copy of the logic used in the DefaultArtifactCollector, and this method was
* called right before the actual version/artifactScope changes were done. However, a different set of conditionals (and * called right before the actual version/artifactScope changes were done. However, a different set of conditionals
* more information) is needed to be able to determine when and if the version and/or artifactScope changes. See the two * (and more information) is needed to be able to determine when and if the version and/or artifactScope changes.
* added methods, manageArtifactVersion and manageArtifactScope. * See the two added methods, manageArtifactVersion and manageArtifactScope.
*/ */
public void manageArtifact( Artifact artifact, Artifact replacement ) public void manageArtifact( Artifact artifact, Artifact replacement )
{ {

View File

@ -115,15 +115,15 @@ public void execute( Runnable command )
} }
else else
{ {
executor = executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
new DaemonThreadCreator() );
} }
} }
private RepositorySystemSession getSession( ArtifactRepository localRepository ) private RepositorySystemSession getSession( ArtifactRepository localRepository )
{ {
return LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(), repoSystem ); return LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(),
repoSystem );
} }
private void injectSession1( RepositoryRequest request, MavenSession session ) private void injectSession1( RepositoryRequest request, MavenSession session )
@ -176,17 +176,20 @@ private void resolve( Artifact artifact, List<ArtifactRepository> remoteReposito
if ( systemFile == null ) if ( systemFile == null )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached", artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached",
artifact );
} }
if ( !systemFile.exists() ) if ( !systemFile.exists() )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: " + systemFile, artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: "
+ systemFile, artifact );
} }
if ( !systemFile.isFile() ) if ( !systemFile.isFile() )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile, artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile,
artifact );
} }
artifact.setResolved( true ); artifact.setResolved( true );
@ -252,7 +255,8 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
ArtifactRepository localRepository, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
remoteRepositories, source, filter ); remoteRepositories, source, filter );
@ -260,20 +264,24 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, null ); remoteRepositories, source, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, filter, null ); remoteRepositories, source, filter, null );
@ -283,7 +291,8 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactRepository localRepository,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null );
} }
@ -293,41 +302,40 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
ArtifactRepository localRepository, ArtifactRepository localRepository,
ArtifactMetadataSource source, ArtifactMetadataSource source,
List<ResolutionListener> listeners ) List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
remoteRepositories, source, null, listeners ); remoteRepositories, source, null, listeners );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter, ArtifactMetadataSource source, ArtifactFilter filter,
List<ResolutionListener> listeners ) List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, filter, listeners, null ); remoteRepositories, source, filter, listeners, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map<String,Artifact> managedVersions, ArtifactRepository localRepository, Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter, ArtifactMetadataSource source, ArtifactFilter filter,
List<ResolutionListener> listeners, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers ) List<ConflictResolver> conflictResolvers )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException,
ArtifactNotFoundException
{ {
ArtifactResolutionRequest request = new ArtifactResolutionRequest() ArtifactResolutionRequest request =
.setArtifact( originatingArtifact ) new ArtifactResolutionRequest().setArtifact( originatingArtifact ).setResolveRoot( false )
.setResolveRoot( false )
// This is required by the surefire plugin // This is required by the surefire plugin
.setArtifactDependencies( artifacts ) .setArtifactDependencies( artifacts ).setManagedVersionMap( managedVersions ).setLocalRepository( localRepository ).setRemoteRepositories( remoteRepositories ).setCollectionFilter( filter ).setListeners( listeners );
.setManagedVersionMap( managedVersions )
.setLocalRepository( localRepository )
.setRemoteRepositories( remoteRepositories )
.setCollectionFilter( filter )
.setListeners( listeners );
injectSession2( request, legacySupport.getSession() ); injectSession2( request, legacySupport.getSession() );
@ -362,7 +370,8 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
ArtifactFilter resolutionFilter = request.getResolutionFilter(); ArtifactFilter resolutionFilter = request.getResolutionFilter();
RepositorySystemSession session = getSession( request.getLocalRepository() ); RepositorySystemSession session = getSession( request.getLocalRepository() );
//TODO: hack because metadata isn't generated in m2e correctly and i want to run the maven i have in the workspace // TODO: hack because metadata isn't generated in m2e correctly and i want to run the maven i have in the
// workspace
if ( source == null ) if ( source == null )
{ {
try try
@ -481,15 +490,15 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
} }
// After the collection we will have the artifact object in the result but they will not be resolved yet. // After the collection we will have the artifact object in the result but they will not be resolved yet.
result = result = artifactCollector.collect( artifacts, rootArtifact, managedVersions, collectionRequest, source,
artifactCollector.collect( artifacts, rootArtifact, managedVersions, collectionRequest, source,
collectionFilter, listeners, null ); collectionFilter, listeners, null );
// We have metadata retrieval problems, or there are cycles that have been detected // We have metadata retrieval problems, or there are cycles that have been detected
// so we give this back to the calling code and let them deal with this information // so we give this back to the calling code and let them deal with this information
// appropriately. // appropriately.
if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations() || result.hasCircularDependencyExceptions() ) if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations()
|| result.hasCircularDependencyExceptions() )
{ {
return result; return result;
} }
@ -539,7 +548,8 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
return result; return result;
} }
public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
resolve( artifact, remoteRepositories, localRepository, null ); resolve( artifact, remoteRepositories, localRepository, null );
@ -582,8 +592,9 @@ private class ResolveTask
private final ArtifactResolutionResult result; private final ArtifactResolutionResult result;
public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact, RepositorySystemSession session, public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact,
List<ArtifactRepository> remoteRepositories, ArtifactResolutionResult result ) RepositorySystemSession session, List<ArtifactRepository> remoteRepositories,
ArtifactResolutionResult result )
{ {
this.classLoader = classLoader; this.classLoader = classLoader;
this.latch = latch; this.latch = latch;

View File

@ -674,8 +674,8 @@ boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List<
fireEvent( ResolutionListener.UPDATE_SCOPE, listeners, nearest, farthestArtifact ); fireEvent( ResolutionListener.UPDATE_SCOPE, listeners, nearest, farthestArtifact );
// previously we cloned the artifact, but it is more effecient to just update the artifactScope // previously we cloned the artifact, but it is more effecient to just update the artifactScope
// if problems are later discovered that the original object needs its original artifactScope value, cloning // if problems are later discovered that the original object needs its original artifactScope value,
// may // cloning may
// again be appropriate // again be appropriate
nearestArtifact.setScope( farthestArtifact.getScope() ); nearestArtifact.setScope( farthestArtifact.getScope() );
} }