licenses and intention changes

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-30 15:52:15 +00:00
parent b8d98d1cff
commit 5e75912ed1
3 changed files with 78 additions and 45 deletions

View File

@ -96,15 +96,15 @@ public class DefaultLifecycleExecutor
* Execute a task. Each task may be a phase in the lifecycle or the * Execute a task. Each task may be a phase in the lifecycle or the
* execution of a mojo. * execution of a mojo.
* *
* @param tasks
* @param session * @param session
* @param project * @param project
* @param dispatcher
*/ */
public MavenExecutionResponse execute( MavenSession session, MavenProject project, EventDispatcher dispatcher ) public MavenExecutionResponse execute( MavenSession session, MavenProject project, EventDispatcher dispatcher )
throws LifecycleExecutionException throws LifecycleExecutionException
{ {
List taskSegments = segmentTaskListByAggregationNeeds( session.getGoals(), session, project ); List taskSegments = segmentTaskListByAggregationNeeds( session.getGoals(), session, project );
MavenExecutionResponse response = new MavenExecutionResponse(); MavenExecutionResponse response = new MavenExecutionResponse();
response.setStart( new Date() ); response.setStart( new Date() );
@ -155,20 +155,19 @@ public class DefaultLifecycleExecutor
} }
private void executeTaskSegments( List taskSegments, MavenSession session, MavenProject project, private void executeTaskSegments( List taskSegments, MavenSession session, MavenProject project,
EventDispatcher dispatcher ) EventDispatcher dispatcher )
throws PluginNotFoundException, MojoExecutionException, ArtifactResolutionException, throws PluginNotFoundException, MojoExecutionException, ArtifactResolutionException, LifecycleExecutionException
LifecycleExecutionException
{ {
for ( Iterator it = taskSegments.iterator(); it.hasNext(); ) for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
{ {
TaskSegment segment = (TaskSegment) it.next(); TaskSegment segment = (TaskSegment) it.next();
if ( segment.aggregate() ) if ( segment.aggregate() )
{ {
line(); line();
getLogger().info( "Building " + project.getName() ); getLogger().info( "Building " + project.getName() );
getLogger().info( " " + segment ); getLogger().info( " " + segment );
line(); line();
@ -188,29 +187,29 @@ public class DefaultLifecycleExecutor
executeGoal( task, session, project ); executeGoal( task, session, project );
} }
dispatcher.dispatchEnd( event, project.getId() + " ( " + segment + " )" ); dispatcher.dispatchEnd( event, project.getId() + " ( " + segment + " )" );
} }
catch ( LifecycleExecutionException e ) catch ( LifecycleExecutionException e )
{ {
dispatcher.dispatchError( event, project.getId() + " ( " + segment + " )", e ); dispatcher.dispatchError( event, project.getId() + " ( " + segment + " )", e );
throw e; throw e;
} }
} }
else else
{ {
List sortedProjects = session.getSortedProjects(); List sortedProjects = session.getSortedProjects();
// iterate over projects, and execute on each... // iterate over projects, and execute on each...
for ( Iterator projectIterator = sortedProjects.iterator(); projectIterator.hasNext(); ) for ( Iterator projectIterator = sortedProjects.iterator(); projectIterator.hasNext(); )
{ {
MavenProject currentProject = (MavenProject) projectIterator.next(); MavenProject currentProject = (MavenProject) projectIterator.next();
line(); line();
getLogger().info( "Building " + currentProject.getName() ); getLogger().info( "Building " + currentProject.getName() );
getLogger().info( " " + segment ); getLogger().info( " " + segment );
line(); line();
@ -229,13 +228,13 @@ public class DefaultLifecycleExecutor
executeGoal( task, session, currentProject ); executeGoal( task, session, currentProject );
} }
dispatcher.dispatchEnd( event, currentProject.getId() + " ( " + segment + " )" ); dispatcher.dispatchEnd( event, currentProject.getId() + " ( " + segment + " )" );
} }
catch ( LifecycleExecutionException e ) catch ( LifecycleExecutionException e )
{ {
dispatcher.dispatchError( event, currentProject.getId() + " ( " + segment + " )", e ); dispatcher.dispatchError( event, currentProject.getId() + " ( " + segment + " )", e );
throw e; throw e;
} }
} }
@ -243,16 +242,15 @@ public class DefaultLifecycleExecutor
} }
} }
private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project ) private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
throws LifecycleExecutionException
{ {
List segments = new ArrayList(); List segments = new ArrayList();
TaskSegment currentSegment = null; TaskSegment currentSegment = null;
for ( Iterator it = tasks.iterator(); it.hasNext(); ) for ( Iterator it = tasks.iterator(); it.hasNext(); )
{ {
String task = (String) it.next(); String task = (String) it.next();
// if it's a phase, then we don't need to check whether it's an aggregator. // if it's a phase, then we don't need to check whether it's an aggregator.
// simply add it to the current task partition. // simply add it to the current task partition.
if ( phases.contains( task ) ) if ( phases.contains( task ) )
@ -262,12 +260,12 @@ public class DefaultLifecycleExecutor
segments.add( currentSegment ); segments.add( currentSegment );
currentSegment = null; currentSegment = null;
} }
if ( currentSegment == null ) if ( currentSegment == null )
{ {
currentSegment = new TaskSegment(); currentSegment = new TaskSegment();
} }
currentSegment.add( task ); currentSegment.add( task );
} }
else else
@ -279,15 +277,17 @@ public class DefaultLifecycleExecutor
} }
catch ( LifecycleExecutionException e ) catch ( LifecycleExecutionException e )
{ {
getLogger().info( "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." ); getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e ); getLogger().debug( "", e );
} }
catch ( ArtifactResolutionException e ) catch ( ArtifactResolutionException e )
{ {
getLogger().info( "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." ); getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e ); getLogger().debug( "", e );
} }
if ( mojo != null && mojo.isAggregator() ) if ( mojo != null && mojo.isAggregator() )
{ {
if ( currentSegment != null && !currentSegment.aggregate() ) if ( currentSegment != null && !currentSegment.aggregate() )
@ -295,12 +295,12 @@ public class DefaultLifecycleExecutor
segments.add( currentSegment ); segments.add( currentSegment );
currentSegment = null; currentSegment = null;
} }
if ( currentSegment == null ) if ( currentSegment == null )
{ {
currentSegment = new TaskSegment( true ); currentSegment = new TaskSegment( true );
} }
currentSegment.add( task ); currentSegment.add( task );
} }
else else
@ -310,19 +310,19 @@ public class DefaultLifecycleExecutor
segments.add( currentSegment ); segments.add( currentSegment );
currentSegment = null; currentSegment = null;
} }
if ( currentSegment == null ) if ( currentSegment == null )
{ {
currentSegment = new TaskSegment(); currentSegment = new TaskSegment();
} }
currentSegment.add( task ); currentSegment.add( task );
} }
} }
} }
segments.add( currentSegment ); segments.add( currentSegment );
return segments; return segments;
} }
@ -887,7 +887,7 @@ public class DefaultLifecycleExecutor
project.addPlugin( plugin ); project.addPlugin( plugin );
} }
} }
protected void line() protected void line()
{ {
getLogger().info( "----------------------------------------------------------------------------" ); getLogger().info( "----------------------------------------------------------------------------" );
@ -896,43 +896,44 @@ public class DefaultLifecycleExecutor
private static class TaskSegment private static class TaskSegment
{ {
private boolean aggregate = false; private boolean aggregate = false;
private List tasks = new ArrayList(); private List tasks = new ArrayList();
TaskSegment() TaskSegment()
{ {
} }
TaskSegment( boolean aggregate ) TaskSegment( boolean aggregate )
{ {
this.aggregate = aggregate; this.aggregate = aggregate;
} }
public String toString() public String toString()
{ {
StringBuffer message = new StringBuffer(); StringBuffer message = new StringBuffer();
message.append( " task-segment: [" ); message.append( " task-segment: [" );
for ( Iterator it = tasks.iterator(); it.hasNext(); ) for ( Iterator it = tasks.iterator(); it.hasNext(); )
{ {
String task = (String) it.next(); String task = (String) it.next();
message.append( task ); message.append( task );
if ( it.hasNext() ) if ( it.hasNext() )
{ {
message.append( ", "); message.append( ", " );
} }
} }
message.append( "]" ); message.append( "]" );
if ( aggregate ) if ( aggregate )
{ {
message.append( " (aggregator-style)" ); message.append( " (aggregator-style)" );
} }
return message.toString(); return message.toString();
} }
@ -940,12 +941,12 @@ public class DefaultLifecycleExecutor
{ {
return aggregate; return aggregate;
} }
void add( String task ) void add( String task )
{ {
tasks.add( task ); tasks.add( task );
} }
List getTasks() List getTasks()
{ {
return tasks; return tasks;

View File

@ -1,5 +1,21 @@
package org.apache.maven.plugin.mapping; package org.apache.maven.plugin.mapping;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.InvalidRepositoryMetadataException; import org.apache.maven.artifact.repository.metadata.InvalidRepositoryMetadataException;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException;

View File

@ -1,5 +1,21 @@
package org.apache.maven.plugin.mapping; package org.apache.maven.plugin.mapping;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException;
@ -9,7 +25,7 @@ public interface MavenPluginMappingBuilder
{ {
PluginMappingManager loadPluginMappings( List pluginGroupIds, List pluginRepositories, PluginMappingManager loadPluginMappings( List pluginGroupIds, List pluginRepositories,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws RepositoryMetadataManagementException, PluginMappingManagementException; throws RepositoryMetadataManagementException, PluginMappingManagementException;
PluginMappingManager refreshPluginMappingManager( PluginMappingManager mappingManager, List pluginRepositories, PluginMappingManager refreshPluginMappingManager( PluginMappingManager mappingManager, List pluginRepositories,