mirror of https://github.com/apache/maven.git
code firmatting and simplification
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1169507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
872db6267c
commit
38dc277f47
|
@ -183,7 +183,8 @@ public class DefaultMaven
|
|||
//TODO: Need a general way to inject standard properties
|
||||
if ( request.getStartTime() != null )
|
||||
{
|
||||
request.getSystemProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
|
||||
request.getSystemProperties().put( "${build.timestamp}",
|
||||
new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
|
||||
}
|
||||
|
||||
request.setStartTime( new Date() );
|
||||
|
@ -463,16 +464,9 @@ public class DefaultMaven
|
|||
|
||||
private String getUserAgent()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder( 128 );
|
||||
|
||||
buffer.append( "Apache-Maven/" ).append( getMavenVersion() );
|
||||
buffer.append( " (" );
|
||||
buffer.append( "Java " ).append( System.getProperty( "java.version" ) );
|
||||
buffer.append( "; " );
|
||||
buffer.append( System.getProperty( "os.name" ) ).append( " " ).append( System.getProperty( "os.version" ) );
|
||||
buffer.append( ")" );
|
||||
|
||||
return buffer.toString();
|
||||
return "Apache-Maven/" + getMavenVersion()
|
||||
+ " (Java " + System.getProperty( "java.version" ) + "; "
|
||||
+ System.getProperty( "os.name" ) + " " + System.getProperty( "os.version" ) + ")";
|
||||
}
|
||||
|
||||
private String getMavenVersion()
|
||||
|
@ -496,7 +490,6 @@ public class DefaultMaven
|
|||
return props.getProperty( "version", "unknown-version" );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ResultOfMethodCallIgnored"})
|
||||
private void validateLocalRepository( MavenExecutionRequest request )
|
||||
throws LocalRepositoryNotAccessibleException
|
||||
{
|
||||
|
@ -587,7 +580,7 @@ public class DefaultMaven
|
|||
request.setProjectPresent( false );
|
||||
return projects;
|
||||
}
|
||||
|
||||
|
||||
List<File> files = Arrays.asList( request.getPom().getAbsoluteFile() );
|
||||
collectProjects( projects, files, request );
|
||||
return projects;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DefaultProjectDependenciesResolver
|
|||
|
||||
/*
|
||||
|
||||
Logic for transitve global exclusions
|
||||
Logic for transitive global exclusions
|
||||
|
||||
List<String> exclusions = new ArrayList<String>();
|
||||
|
||||
|
|
|
@ -105,12 +105,9 @@ class DefaultProjectDependencyGraph
|
|||
{
|
||||
for ( String id : sorter.getDependencies( projectId ) )
|
||||
{
|
||||
if ( projectIds.add( id ) )
|
||||
if ( projectIds.add( id ) && transitive )
|
||||
{
|
||||
if ( transitive )
|
||||
{
|
||||
getUpstreamProjects( id, projectIds, transitive );
|
||||
}
|
||||
getUpstreamProjects( id, projectIds, transitive );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ class ReactorReader
|
|||
|
||||
private WorkspaceRepository repository;
|
||||
|
||||
@SuppressWarnings( { "ConstantConditions" } )
|
||||
public ReactorReader( Map<String, MavenProject> reactorProjects )
|
||||
{
|
||||
projectsByGAV = reactorProjects;
|
||||
|
@ -203,15 +202,8 @@ class ReactorReader
|
|||
*/
|
||||
private static boolean isTestArtifact( Artifact artifact )
|
||||
{
|
||||
if ( "test-jar".equals( artifact.getProperty( "type", "" ) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( "jar".equals( artifact.getExtension() ) && "tests".equals( artifact.getClassifier() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ( "test-jar".equals( artifact.getProperty( "type", "" ) ) )
|
||||
|| ( "jar".equals( artifact.getExtension() ) && "tests".equals( artifact.getClassifier() ) );
|
||||
}
|
||||
|
||||
public File findArtifact( Artifact artifact )
|
||||
|
|
|
@ -107,7 +107,6 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
// USED BY MAVEN HELP PLUGIN
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
@Deprecated
|
||||
public Map<String, Lifecycle> getPhaseToLifecycleMap()
|
||||
{
|
||||
|
@ -167,7 +166,6 @@ public class DefaultLifecycleExecutor
|
|||
lifecycleExecutionPlanCalculator.calculateForkedExecutions( mojoExecution, session );
|
||||
}
|
||||
|
||||
|
||||
// Site 3.x
|
||||
public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
|
||||
throws LifecycleExecutionException
|
||||
|
|
|
@ -53,7 +53,6 @@ public class DefaultLifecycles
|
|||
@Requirement
|
||||
private Logger logger;
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public DefaultLifecycles()
|
||||
{
|
||||
}
|
||||
|
@ -112,11 +111,11 @@ public class DefaultLifecycles
|
|||
public List<Lifecycle> getLifeCycles()
|
||||
{
|
||||
// ensure canonical order of standard lifecycles
|
||||
|
||||
Map<String, Lifecycle> lifecycles = new LinkedHashMap<String, Lifecycle>( this.lifecycles );
|
||||
|
||||
LinkedHashSet<String> lifecycleNames = new LinkedHashSet<String>( Arrays.asList( STANDARD_LIFECYCLES ) );
|
||||
lifecycleNames.addAll( lifecycles.keySet() );
|
||||
|
||||
ArrayList<Lifecycle> result = new ArrayList<Lifecycle>();
|
||||
for ( String name : lifecycleNames )
|
||||
{
|
||||
|
|
|
@ -37,7 +37,6 @@ public class DefaultSchedules
|
|||
{
|
||||
List<Scheduling> schedules;
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public DefaultSchedules()
|
||||
{
|
||||
}
|
||||
|
@ -56,6 +55,7 @@ public class DefaultSchedules
|
|||
{
|
||||
String lifeCyclePhase = mojoExecution.getLifecyclePhase();
|
||||
final Scheduling scheduling = getScheduling( "default" );
|
||||
|
||||
Schedule schedule = null;
|
||||
if ( scheduling != null )
|
||||
{
|
||||
|
@ -65,8 +65,8 @@ public class DefaultSchedules
|
|||
schedule = scheduling.getSchedule( lifeCyclePhase );
|
||||
}
|
||||
}
|
||||
result.add( new ExecutionPlanItem( mojoExecution, schedule ) );
|
||||
|
||||
result.add( new ExecutionPlanItem( mojoExecution, schedule ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -96,4 +96,4 @@ public class DefaultSchedules
|
|||
{
|
||||
return schedules;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,12 +36,10 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A facade that provides lifecycle services to components outside maven core.
|
||||
*
|
||||
* A facade that provides lifecycle services to components outside Maven core.
|
||||
*
|
||||
* @author Jason van Zyl
|
||||
*/
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public interface LifecycleExecutor
|
||||
{
|
||||
|
||||
|
@ -53,7 +51,7 @@ public interface LifecycleExecutor
|
|||
// lifecycles. The project builder needs to now what default plugin information needs to be
|
||||
// merged into POM being built. Once the POM builder has this plugin information, versions can be assigned
|
||||
// by the POM builder because they will have to be defined in plugin management. Once this is setComplete then it
|
||||
// can be passed back so that the default configuraiton information can be populated.
|
||||
// can be passed back so that the default configuration information can be populated.
|
||||
//
|
||||
// We need to know the specific version so that we can lookup the right version of the plugin descriptor
|
||||
// which tells us what the default configuration is.
|
||||
|
@ -85,10 +83,7 @@ public interface LifecycleExecutor
|
|||
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
|
||||
|
||||
|
||||
// used by the site plugin 3.x
|
||||
List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
|
||||
throws LifecycleExecutionException;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public class MavenExecutionPlan
|
|||
|
||||
private final Map<String, ExecutionPlanItem> lastMojoExecutionForAllPhases;
|
||||
|
||||
|
||||
final List<String> phasesInExecutionPlan;
|
||||
|
||||
public MavenExecutionPlan( List<ExecutionPlanItem> planItem, DefaultLifecycles defaultLifecycles )
|
||||
|
@ -88,17 +87,16 @@ public class MavenExecutionPlan
|
|||
}
|
||||
|
||||
ExecutionPlanItem lastSeenExecutionPlanItem = null;
|
||||
ExecutionPlanItem forThisPhase;
|
||||
|
||||
for ( String phase : totalPhaseSet )
|
||||
{
|
||||
forThisPhase = lastInExistingPhases.get( phase );
|
||||
ExecutionPlanItem forThisPhase = lastInExistingPhases.get( phase );
|
||||
if ( forThisPhase != null )
|
||||
{
|
||||
lastSeenExecutionPlanItem = forThisPhase;
|
||||
}
|
||||
lastMojoExecutionForAllPhases.put( phase, lastSeenExecutionPlanItem );
|
||||
|
||||
lastMojoExecutionForAllPhases.put( phase, lastSeenExecutionPlanItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +123,6 @@ public class MavenExecutionPlan
|
|||
return planItem;
|
||||
}
|
||||
|
||||
|
||||
private static Iterable<String> getDistinctPhasesInOrderOfExecutionPlanAppearance(
|
||||
List<ExecutionPlanItem> planItems )
|
||||
{
|
||||
|
@ -189,8 +186,6 @@ public class MavenExecutionPlan
|
|||
}
|
||||
|
||||
// Used by m2e but will be removed, really.
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
@Deprecated
|
||||
public List<MojoExecution> getExecutions()
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.maven.plugin.MojoExecution;
|
|||
* @since 3.0
|
||||
* @author Kristian Rosenvold
|
||||
*/
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public class Schedule
|
||||
{
|
||||
private String phase;
|
||||
|
@ -122,33 +121,23 @@ public class Schedule
|
|||
|
||||
public boolean appliesTo( MojoExecution mojoExecution )
|
||||
{
|
||||
boolean pluginKeyMatches = true;
|
||||
boolean pluginGoalMatches = true;
|
||||
if ( pluginKey == null && mojoGoal == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( pluginKey != null )
|
||||
{
|
||||
pluginKeyMatches = pluginKey.equals( mojoExecution.getPlugin().getKey() );
|
||||
}
|
||||
if ( mojoGoal != null )
|
||||
{
|
||||
pluginGoalMatches = mojoGoal.equals( mojoExecution.getGoal() );
|
||||
}
|
||||
|
||||
if ( pluginKeyMatches && pluginGoalMatches )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
boolean pluginKeyMatches = ( pluginKey == null ) || pluginKey.equals( mojoExecution.getPlugin().getKey() );
|
||||
|
||||
boolean pluginGoalMatches = ( mojoGoal == null ) || mojoGoal.equals( mojoExecution.getGoal() );
|
||||
|
||||
return pluginKeyMatches && pluginGoalMatches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Schedule{" + "phase='" + phase + '\'' + ", upstreamPhase='" + upstreamPhase + '\'' + ", pluginKey='"
|
||||
+ pluginKey + '\'' + ", mojoGoal='" + mojoGoal + '\'' + ", mojoSynchronized=" + mojoSynchronized
|
||||
return "Schedule{" + "phase='" + phase + "', upstreamPhase='" + upstreamPhase + "', pluginKey='"
|
||||
+ pluginKey + "', mojoGoal='" + mojoGoal + "', mojoSynchronized=" + mojoSynchronized
|
||||
+ ", parallel=" + parallel + '}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,33 +62,33 @@ public class Scheduling
|
|||
|
||||
public Schedule getSchedule( String phaseName )
|
||||
{
|
||||
if ( phaseName == null )
|
||||
if ( phaseName != null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
if ( phaseName.equals( schedule.getPhase() ) )
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
return schedule;
|
||||
if ( phaseName.equals( schedule.getPhase() ) )
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Schedule getSchedule( MojoExecution mojoExecution )
|
||||
{
|
||||
if ( mojoExecution == null )
|
||||
if ( mojoExecution != null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
if ( schedule.appliesTo( mojoExecution ) )
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
return schedule;
|
||||
if ( schedule.appliesTo( mojoExecution ) )
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue