mirror of https://github.com/apache/maven.git
fixed errors reported by Checkstyle
This commit is contained in:
parent
3729324a13
commit
73d35ba959
|
@ -76,15 +76,12 @@ class DefaultProjectDependencyGraph
|
|||
{
|
||||
for ( String id : sorter.getDependents( projectId ) )
|
||||
{
|
||||
if ( projectIds.add( id ) )
|
||||
{
|
||||
if ( transitive )
|
||||
if ( projectIds.add( id ) && transitive )
|
||||
{
|
||||
getDownstreamProjects( id, projectIds, transitive );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive )
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ public class InvalidRepositoryException
|
|||
@Deprecated
|
||||
public InvalidRepositoryException( String message, Throwable t )
|
||||
{
|
||||
super( message );
|
||||
super( message, t );
|
||||
this.repositoryId = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,14 +242,11 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
|
||||
private void baseDirectory( MavenExecutionRequest request )
|
||||
{
|
||||
if ( request.getBaseDirectory() == null )
|
||||
{
|
||||
if ( request.getPom() != null )
|
||||
if ( request.getBaseDirectory() == null && request.getPom() != null )
|
||||
{
|
||||
request.setBaseDirectory( request.getPom().getAbsoluteFile().getParentFile() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
|
||||
throws MavenExecutionRequestPopulationException
|
||||
|
|
|
@ -177,12 +177,12 @@ public interface MavenExecutionRequest
|
|||
*
|
||||
* @param degreeOfConcurrency
|
||||
*/
|
||||
public void setDegreeOfConcurrency( final int degreeOfConcurrency );
|
||||
void setDegreeOfConcurrency( int degreeOfConcurrency );
|
||||
|
||||
/**
|
||||
* @return the degree of concurrency for the build.
|
||||
*/
|
||||
public int getDegreeOfConcurrency();
|
||||
int getDegreeOfConcurrency();
|
||||
|
||||
// Recursive (really to just process the top-level POM)
|
||||
MavenExecutionRequest setRecursive( boolean recursive );
|
||||
|
|
|
@ -75,13 +75,10 @@ public class DefaultLifecycleTaskSegmentCalculator
|
|||
|
||||
List<String> tasks = session.getGoals();
|
||||
|
||||
if ( tasks == null || tasks.isEmpty() )
|
||||
{
|
||||
if ( !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
|
||||
if ( ( tasks == null || tasks.isEmpty() ) && !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
|
||||
{
|
||||
tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return calculateTaskSegments( session, tasks );
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.maven.project.MavenProject;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* Wraps individual MojoExecutions, containing information about completion status and scheduling.
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface LifecycleTaskSegmentCalculator
|
|||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException;
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.aether.artifact.Artifact;
|
|||
public interface ExtensionRealmCache
|
||||
{
|
||||
|
||||
public static class CacheRecord
|
||||
static class CacheRecord
|
||||
{
|
||||
|
||||
public final ClassRealm realm;
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface PluginArtifactsCache
|
|||
// marker interface for cache keys
|
||||
}
|
||||
|
||||
public static class CacheRecord
|
||||
static class CacheRecord
|
||||
{
|
||||
|
||||
public final List<Artifact> artifacts;
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.aether.repository.RemoteRepository;
|
|||
public interface PluginRealmCache
|
||||
{
|
||||
|
||||
public static class CacheRecord
|
||||
static class CacheRecord
|
||||
{
|
||||
public final ClassRealm realm;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ public class DefaultPluginDependenciesResolver
|
|||
org.eclipse.aether.graph.Dependency dep = node.getDependency();
|
||||
if ( dep != null )
|
||||
{
|
||||
org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
|
||||
Artifact art = dep.getArtifact();
|
||||
|
||||
buffer.append( art );
|
||||
buffer.append( ':' ).append( dep.getScope() );
|
||||
|
|
|
@ -71,7 +71,6 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
@ -486,15 +485,12 @@ public class MavenProject
|
|||
if ( path != null )
|
||||
{
|
||||
path = path.trim();
|
||||
if ( path.length() != 0 )
|
||||
{
|
||||
if ( !getScriptSourceRoots().contains( path ) )
|
||||
if ( path.length() != 0 && !getScriptSourceRoots().contains( path ) )
|
||||
{
|
||||
getScriptSourceRoots().add( path );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addTestCompileSourceRoot( String path )
|
||||
{
|
||||
|
@ -529,15 +525,13 @@ public class MavenProject
|
|||
|
||||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
&& ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) )
|
||||
{
|
||||
addArtifactPath( a, list );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -550,15 +544,13 @@ public class MavenProject
|
|||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
// TODO: classpath check doesn't belong here - that's the other method
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
&& ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) )
|
||||
{
|
||||
list.add( a );
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -681,15 +673,13 @@ public class MavenProject
|
|||
|
||||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
|
||||
&& ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
|
||||
{
|
||||
addArtifactPath( a, list );
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -701,15 +691,13 @@ public class MavenProject
|
|||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
// TODO: classpath check doesn't belong here - that's the other method
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
|
||||
&& ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
|
||||
{
|
||||
list.add( a );
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -758,15 +746,13 @@ public class MavenProject
|
|||
|
||||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
&& Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
{
|
||||
addArtifactPath( a, list );
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -778,15 +764,13 @@ public class MavenProject
|
|||
for ( Artifact a : getArtifacts() )
|
||||
{
|
||||
// TODO: classpath check doesn't belong here - that's the other method
|
||||
if ( a.getArtifactHandler().isAddedToClasspath() )
|
||||
{
|
||||
if ( a.getArtifactHandler().isAddedToClasspath()
|
||||
// TODO: let the scope handler deal with this
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
&& Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
{
|
||||
list.add( a );
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -1892,26 +1876,22 @@ public class MavenProject
|
|||
|
||||
protected ArtifactRepository getReleaseArtifactRepository()
|
||||
{
|
||||
if ( releaseArtifactRepository == null )
|
||||
{
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getRepository() != null )
|
||||
if ( releaseArtifactRepository == null && getDistributionManagement() != null
|
||||
&& getDistributionManagement().getRepository() != null )
|
||||
{
|
||||
checkProjectBuildingRequest();
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setReleaseArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create release distribution repository for " + getId(),
|
||||
e );
|
||||
}
|
||||
throw new IllegalStateException( "Failed to create release distribution repository for " + getId(), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1920,27 +1900,22 @@ public class MavenProject
|
|||
|
||||
protected ArtifactRepository getSnapshotArtifactRepository()
|
||||
{
|
||||
if ( snapshotArtifactRepository == null )
|
||||
{
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getSnapshotRepository() != null )
|
||||
if ( snapshotArtifactRepository == null && getDistributionManagement() != null
|
||||
&& getDistributionManagement().getSnapshotRepository() != null )
|
||||
{
|
||||
checkProjectBuildingRequest();
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setSnapshotArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"Failed to create snapshot distribution repository for " + getId(),
|
||||
e );
|
||||
}
|
||||
throw new IllegalStateException( "Failed to create snapshot distribution repository for " + getId(), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.aether.graph.DependencyFilter;
|
|||
public interface ProjectRealmCache
|
||||
{
|
||||
|
||||
public static class CacheRecord
|
||||
static class CacheRecord
|
||||
{
|
||||
|
||||
public final ClassRealm realm;
|
||||
|
|
|
@ -157,14 +157,12 @@ public class MavenMetadataSource
|
|||
cache.get( artifact, request.isResolveManagedVersions(), request.getLocalRepository(),
|
||||
request.getRemoteRepositories() );
|
||||
|
||||
if ( cached != null )
|
||||
{
|
||||
if ( cached != null
|
||||
// if the POM has no file, we cached a missing artifact, only return the cached data if no update forced
|
||||
if ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) )
|
||||
&& ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) ) )
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
List<Dependency> dependencies;
|
||||
|
||||
|
|
Loading…
Reference in New Issue