diff options
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal')
40 files changed, 0 insertions, 5629 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java deleted file mode 100644 index 771385cc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @since 3.0 - * @author Kristian Rosenvold - * This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = BuildListCalculator.class ) -public class BuildListCalculator -{ - public ProjectBuildList calculateProjectBuilds( MavenSession session, List<TaskSegment> taskSegments ) - { - List<ProjectSegment> projectBuilds = new ArrayList<ProjectSegment>(); - - MavenProject rootProject = session.getTopLevelProject(); - - for ( TaskSegment taskSegment : taskSegments ) - { - List<MavenProject> projects; - - if ( taskSegment.isAggregating() ) - { - projects = Collections.singletonList( rootProject ); - } - else - { - projects = session.getProjects(); - } - for ( MavenProject project : projects ) - { - BuilderCommon.attachToThread( project ); // Not totally sure if this is needed for anything - MavenSession copiedSession = session.clone(); - copiedSession.setCurrentProject( project ); - projectBuilds.add( new ProjectSegment( project, taskSegment, copiedSession ) ); - } - } - return new ProjectBuildList( projectBuilds ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java deleted file mode 100644 index 01545078..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Simple {@link ThreadFactory} implementation that ensures the corresponding threads have a meaningful name. - */ -public class BuildThreadFactory - implements ThreadFactory -{ - private final AtomicInteger id = new AtomicInteger(); - - private static final String PREFIX = "BuilderThread"; - - public Thread newThread( Runnable r ) - { - return new Thread( r, String.format( "%s %d", PREFIX, id.getAndIncrement() ) ); - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java deleted file mode 100644 index f2a8291a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Collection; - -import org.apache.maven.execution.ProjectExecutionEvent; -import org.apache.maven.execution.ProjectExecutionListener; -import org.apache.maven.lifecycle.LifecycleExecutionException; - -class CompoundProjectExecutionListener - implements ProjectExecutionListener -{ - private final Collection<ProjectExecutionListener> listeners; - - public CompoundProjectExecutionListener( Collection<ProjectExecutionListener> listeners ) - { - this.listeners = listeners; // NB this is live injected collection - } - - public void beforeProjectExecution( ProjectExecutionEvent event ) - throws LifecycleExecutionException - { - for ( ProjectExecutionListener listener : listeners ) - { - listener.beforeProjectExecution( event ); - } - } - - public void beforeProjectLifecycleExecution( ProjectExecutionEvent event ) - throws LifecycleExecutionException - { - for ( ProjectExecutionListener listener : listeners ) - { - listener.beforeProjectLifecycleExecution( event ); - } - } - - public void afterProjectExecutionSuccess( ProjectExecutionEvent event ) - throws LifecycleExecutionException - { - for ( ProjectExecutionListener listener : listeners ) - { - listener.afterProjectExecutionSuccess( event ); - } - } - - public void afterProjectExecutionFailure( ProjectExecutionEvent event ) - { - for ( ProjectExecutionListener listener : listeners ) - { - listener.afterProjectExecutionFailure( event ); - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java deleted file mode 100644 index 9434a659..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.ExecutionEvent; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.project.MavenProject; - -/** - * Holds data relevant for an execution event. - * - * @author Benjamin Bentmann - */ -class DefaultExecutionEvent - implements ExecutionEvent -{ - - private final Type type; - - private final MavenSession session; - - private final MojoExecution mojoExecution; - - private final Exception exception; - - public DefaultExecutionEvent( Type type, MavenSession session, MojoExecution mojoExecution, Exception exception ) - { - this.type = type; - this.session = session; - this.mojoExecution = mojoExecution; - this.exception = exception; - } - - public Type getType() - { - return type; - } - - public MavenSession getSession() - { - return session; - } - - public MavenProject getProject() - { - return session.getCurrentProject(); - } - - public MojoExecution getMojoExecution() - { - return mojoExecution; - } - - public Exception getException() - { - return exception; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java deleted file mode 100644 index bfb98d43..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.ExecutionEvent; -import org.apache.maven.execution.ExecutionListener; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecution; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility class that is only public - * for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without - * prior notice. - * - * @author Benjamin Bentmann - */ -@Component( role = ExecutionEventCatapult.class ) -public class DefaultExecutionEventCatapult - implements ExecutionEventCatapult -{ - - public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution ) - { - fire( eventType, session, mojoExecution, null ); - } - - public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution, - Exception exception ) - { - ExecutionListener listener = session.getRequest().getExecutionListener(); - - if ( listener != null ) - { - ExecutionEvent event = new DefaultExecutionEvent( eventType, session, mojoExecution, exception ); - - switch ( eventType ) - { - case ProjectDiscoveryStarted: - listener.projectDiscoveryStarted( event ); - break; - - case SessionStarted: - listener.sessionStarted( event ); - break; - case SessionEnded: - listener.sessionEnded( event ); - break; - - case ProjectSkipped: - listener.projectSkipped( event ); - break; - case ProjectStarted: - listener.projectStarted( event ); - break; - case ProjectSucceeded: - listener.projectSucceeded( event ); - break; - case ProjectFailed: - listener.projectFailed( event ); - break; - - case MojoSkipped: - listener.mojoSkipped( event ); - break; - case MojoStarted: - listener.mojoStarted( event ); - break; - case MojoSucceeded: - listener.mojoSucceeded( event ); - break; - case MojoFailed: - listener.mojoFailed( event ); - break; - - case ForkStarted: - listener.forkStarted( event ); - break; - case ForkSucceeded: - listener.forkSucceeded( event ); - break; - case ForkFailed: - listener.forkFailed( event ); - break; - - case ForkedProjectStarted: - listener.forkedProjectStarted( event ); - break; - case ForkedProjectSucceeded: - listener.forkedProjectSucceeded( event ); - break; - case ForkedProjectFailed: - listener.forkedProjectFailed( event ); - break; - - default: - throw new IllegalStateException( "Unknown execution event type " + eventType ); - } - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java deleted file mode 100644 index 8cc47cc5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java +++ /dev/null @@ -1,591 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.DefaultLifecycles; -import org.apache.maven.lifecycle.Lifecycle; -import org.apache.maven.lifecycle.LifecycleMappingDelegate; -import org.apache.maven.lifecycle.LifecycleNotFoundException; -import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.lifecycle.MojoExecutionConfigurator; -import org.apache.maven.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.plugin.BuildPluginManager; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.descriptor.Parameter; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugin.lifecycle.Execution; -import org.apache.maven.plugin.lifecycle.Phase; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolver; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import com.google.common.collect.ImmutableMap; - -/** - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (Extract class) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = LifecycleExecutionPlanCalculator.class ) -public class DefaultLifecycleExecutionPlanCalculator - implements LifecycleExecutionPlanCalculator -{ - @Requirement - private PluginVersionResolver pluginVersionResolver; - - @Requirement - private BuildPluginManager pluginManager; - - @Requirement - private DefaultLifecycles defaultLifeCycles; - - @Requirement - private MojoDescriptorCreator mojoDescriptorCreator; - - @Requirement - private LifecyclePluginResolver lifecyclePluginResolver; - - @Requirement( hint = DefaultLifecycleMappingDelegate.HINT ) - private LifecycleMappingDelegate standardDelegate; - - @Requirement - private Map<String, LifecycleMappingDelegate> delegates; - - @Requirement - private Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators; - - @SuppressWarnings( { "UnusedDeclaration" } ) - public DefaultLifecycleExecutionPlanCalculator() - { - } - - // Only used for testing - public DefaultLifecycleExecutionPlanCalculator( BuildPluginManager pluginManager, - DefaultLifecycles defaultLifeCycles, - MojoDescriptorCreator mojoDescriptorCreator, - LifecyclePluginResolver lifecyclePluginResolver ) - { - this.pluginManager = pluginManager; - this.defaultLifeCycles = defaultLifeCycles; - this.mojoDescriptorCreator = mojoDescriptorCreator; - this.lifecyclePluginResolver = lifecyclePluginResolver; - this.mojoExecutionConfigurators = - ImmutableMap.of( "default", (MojoExecutionConfigurator) new DefaultMojoExecutionConfigurator() ); - } - - @Override - public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks, - boolean setup ) - throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, - NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException - { - lifecyclePluginResolver.resolveMissingPluginVersions( project, session ); - - final List<MojoExecution> executions = calculateMojoExecutions( session, project, tasks ); - - if ( setup ) - { - setupMojoExecutions( session, project, executions ); - } - - final List<ExecutionPlanItem> planItem = ExecutionPlanItem.createExecutionPlanItems( project, executions ); - - return new MavenExecutionPlan( planItem, defaultLifeCycles ); - } - - @Override - public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks ) - throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, - NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException - { - return calculateExecutionPlan( session, project, tasks, true ); - } - - private void setupMojoExecutions( MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - for ( MojoExecution mojoExecution : mojoExecutions ) - { - setupMojoExecution( session, project, mojoExecution ); - } - } - - @Override - public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - if ( mojoDescriptor == null ) - { - mojoDescriptor = - pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(), - project.getRemotePluginRepositories(), - session.getRepositorySession() ); - - mojoExecution.setMojoDescriptor( mojoDescriptor ); - } - - mojoExecutionConfigurator( mojoExecution ).configure( project, - mojoExecution, - MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) ); - - finalizeMojoConfiguration( mojoExecution ); - - calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() ); - } - - public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project, List<Object> tasks ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException, LifecyclePhaseNotFoundException - { - final List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>(); - - for ( Object task : tasks ) - { - if ( task instanceof GoalTask ) - { - String pluginGoal = ( (GoalTask) task ).pluginGoal; - - String executionId = "default-cli"; - int executionIdx = pluginGoal.indexOf( '@' ); - if ( executionIdx > 0 ) - { - executionId = pluginGoal.substring( executionIdx + 1 ); - } - - MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project ); - - MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, executionId, - MojoExecution.Source.CLI ); - - mojoExecutions.add( mojoExecution ); - } - else if ( task instanceof LifecycleTask ) - { - String lifecyclePhase = ( (LifecycleTask) task ).getLifecyclePhase(); - - Map<String, List<MojoExecution>> phaseToMojoMapping = - calculateLifecycleMappings( session, project, lifecyclePhase ); - - for ( List<MojoExecution> mojoExecutionsFromLifecycle : phaseToMojoMapping.values() ) - { - mojoExecutions.addAll( mojoExecutionsFromLifecycle ); - } - } - else - { - throw new IllegalStateException( "unexpected task " + task ); - } - } - return mojoExecutions; - } - - private Map<String, List<MojoExecution>> calculateLifecycleMappings( MavenSession session, MavenProject project, - String lifecyclePhase ) - throws LifecyclePhaseNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException - { - /* - * Determine the lifecycle that corresponds to the given phase. - */ - - Lifecycle lifecycle = defaultLifeCycles.get( lifecyclePhase ); - - if ( lifecycle == null ) - { - throw new LifecyclePhaseNotFoundException( "Unknown lifecycle phase \"" + lifecyclePhase - + "\". You must specify a valid lifecycle phase" + " or a goal in the format <plugin-prefix>:<goal> or" - + " <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: " - + defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase ); - } - - LifecycleMappingDelegate delegate; - if ( Arrays.binarySearch( DefaultLifecycles.STANDARD_LIFECYCLES, lifecycle.getId() ) >= 0 ) - { - delegate = standardDelegate; - } - else - { - delegate = delegates.get( lifecycle.getId() ); - if ( delegate == null ) - { - delegate = standardDelegate; - } - } - - return delegate.calculateLifecycleMappings( session, project, lifecycle, lifecyclePhase ); - } - - /** - * Post-processes the effective configuration for the specified mojo execution. This step discards all parameters - * from the configuration that are not applicable to the mojo and injects the default values for any missing - * parameters. - * - * @param mojoExecution The mojo execution whose configuration should be finalized, must not be {@code null}. - */ - private void finalizeMojoConfiguration( MojoExecution mojoExecution ) - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - Xpp3Dom executionConfiguration = mojoExecution.getConfiguration(); - if ( executionConfiguration == null ) - { - executionConfiguration = new Xpp3Dom( "configuration" ); - } - - Xpp3Dom defaultConfiguration = getMojoConfiguration( mojoDescriptor ); - - Xpp3Dom finalConfiguration = new Xpp3Dom( "configuration" ); - - if ( mojoDescriptor.getParameters() != null ) - { - for ( Parameter parameter : mojoDescriptor.getParameters() ) - { - Xpp3Dom parameterConfiguration = executionConfiguration.getChild( parameter.getName() ); - - if ( parameterConfiguration == null ) - { - parameterConfiguration = executionConfiguration.getChild( parameter.getAlias() ); - } - - Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() ); - - parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, - Boolean.TRUE ); - - if ( parameterConfiguration != null ) - { - parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() ); - - if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) - && StringUtils.isNotEmpty( parameter.getImplementation() ) ) - { - parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() ); - } - - finalConfiguration.addChild( parameterConfiguration ); - } - } - } - - mojoExecution.setConfiguration( finalConfiguration ); - } - - private Xpp3Dom getMojoConfiguration( MojoDescriptor mojoDescriptor ) - { - return MojoDescriptorCreator.convert( mojoDescriptor ); - } - - @Override - public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session ) - throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<MojoDescriptor>() ); - } - - private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project, - Collection<MojoDescriptor> alreadyForkedExecutions ) - throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - if ( !mojoDescriptor.isForking() ) - { - return; - } - - if ( !alreadyForkedExecutions.add( mojoDescriptor ) ) - { - return; - } - - List<MavenProject> forkedProjects = - LifecycleDependencyResolver.getProjects( project, session, mojoDescriptor.isAggregator() ); - - for ( MavenProject forkedProject : forkedProjects ) - { - if ( forkedProject != project ) - { - lifecyclePluginResolver.resolveMissingPluginVersions( forkedProject, session ); - } - - List<MojoExecution> forkedExecutions; - - if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) ) - { - forkedExecutions = - calculateForkedLifecycle( mojoExecution, session, forkedProject, alreadyForkedExecutions ); - } - else - { - forkedExecutions = calculateForkedGoal( mojoExecution, session, forkedProject, - alreadyForkedExecutions ); - } - - mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions ); - } - - alreadyForkedExecutions.remove( mojoDescriptor ); - } - - private List<MojoExecution> calculateForkedLifecycle( MojoExecution mojoExecution, MavenSession session, - MavenProject project, - Collection<MojoDescriptor> alreadyForkedExecutions ) - throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - String forkedPhase = mojoDescriptor.getExecutePhase(); - - Map<String, List<MojoExecution>> lifecycleMappings = calculateLifecycleMappings( session, project, - forkedPhase ); - - for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() ) - { - for ( MojoExecution forkedExecution : forkedExecutions ) - { - if ( forkedExecution.getMojoDescriptor() == null ) - { - MojoDescriptor forkedMojoDescriptor = - pluginManager.getMojoDescriptor( forkedExecution.getPlugin(), forkedExecution.getGoal(), - project.getRemotePluginRepositories(), - session.getRepositorySession() ); - - forkedExecution.setMojoDescriptor( forkedMojoDescriptor ); - } - - mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, false ); - } - } - - injectLifecycleOverlay( lifecycleMappings, mojoExecution, session, project ); - - List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>(); - - for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() ) - { - for ( MojoExecution forkedExecution : forkedExecutions ) - { - if ( !alreadyForkedExecutions.contains( forkedExecution.getMojoDescriptor() ) ) - { - finalizeMojoConfiguration( forkedExecution ); - - calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions ); - - mojoExecutions.add( forkedExecution ); - } - } - } - - return mojoExecutions; - } - - private void injectLifecycleOverlay( Map<String, List<MojoExecution>> lifecycleMappings, - MojoExecution mojoExecution, MavenSession session, MavenProject project ) - throws PluginDescriptorParsingException, LifecycleNotFoundException, MojoNotFoundException, - PluginNotFoundException, PluginResolutionException, NoPluginFoundForPrefixException, - InvalidPluginDescriptorException, PluginVersionResolutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor(); - - String forkedLifecycle = mojoDescriptor.getExecuteLifecycle(); - - if ( StringUtils.isEmpty( forkedLifecycle ) ) - { - return; - } - - org.apache.maven.plugin.lifecycle.Lifecycle lifecycleOverlay; - - try - { - lifecycleOverlay = pluginDescriptor.getLifecycleMapping( forkedLifecycle ); - } - catch ( IOException e ) - { - throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e ); - } - catch ( XmlPullParserException e ) - { - throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e ); - } - - if ( lifecycleOverlay == null ) - { - throw new LifecycleNotFoundException( forkedLifecycle ); - } - - for ( Phase phase : lifecycleOverlay.getPhases() ) - { - List<MojoExecution> forkedExecutions = lifecycleMappings.get( phase.getId() ); - - if ( forkedExecutions != null ) - { - for ( Execution execution : phase.getExecutions() ) - { - for ( String goal : execution.getGoals() ) - { - MojoDescriptor forkedMojoDescriptor; - - if ( goal.indexOf( ':' ) < 0 ) - { - forkedMojoDescriptor = pluginDescriptor.getMojo( goal ); - if ( forkedMojoDescriptor == null ) - { - throw new MojoNotFoundException( goal, pluginDescriptor ); - } - } - else - { - forkedMojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( goal, session, project ); - } - - MojoExecution forkedExecution = - new MojoExecution( forkedMojoDescriptor, mojoExecution.getExecutionId() ); - - Xpp3Dom forkedConfiguration = (Xpp3Dom) execution.getConfiguration(); - - forkedExecution.setConfiguration( forkedConfiguration ); - - mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, true ); - - forkedExecutions.add( forkedExecution ); - } - } - - Xpp3Dom phaseConfiguration = (Xpp3Dom) phase.getConfiguration(); - - if ( phaseConfiguration != null ) - { - for ( MojoExecution forkedExecution : forkedExecutions ) - { - Xpp3Dom forkedConfiguration = forkedExecution.getConfiguration(); - - forkedConfiguration = Xpp3Dom.mergeXpp3Dom( phaseConfiguration, forkedConfiguration ); - - forkedExecution.setConfiguration( forkedConfiguration ); - } - } - } - } - } - - // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process - // TODO: take repo mans into account as one may be aggregating prefixes of many - // TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing - // or the user forces the issue - - private List<MojoExecution> calculateForkedGoal( MojoExecution mojoExecution, MavenSession session, - MavenProject project, - Collection<MojoDescriptor> alreadyForkedExecutions ) - throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor(); - - String forkedGoal = mojoDescriptor.getExecuteGoal(); - - MojoDescriptor forkedMojoDescriptor = pluginDescriptor.getMojo( forkedGoal ); - if ( forkedMojoDescriptor == null ) - { - throw new MojoNotFoundException( forkedGoal, pluginDescriptor ); - } - - if ( alreadyForkedExecutions.contains( forkedMojoDescriptor ) ) - { - return Collections.emptyList(); - } - - MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal ); - - mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, true ); - - finalizeMojoConfiguration( forkedExecution ); - - calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions ); - - return Collections.singletonList( forkedExecution ); - } - - private MojoExecutionConfigurator mojoExecutionConfigurator( MojoExecution mojoExecution ) - { - String configuratorId = mojoExecution.getMojoDescriptor().getComponentConfigurator(); - if ( configuratorId == null ) - { - configuratorId = "default"; - } - - MojoExecutionConfigurator mojoExecutionConfigurator = mojoExecutionConfigurators.get( configuratorId ); - - if ( mojoExecutionConfigurator == null ) - { - // - // The plugin has a custom component configurator but does not have a custom mojo execution configurator - // so fall back to the default mojo execution configurator. - // - mojoExecutionConfigurator = mojoExecutionConfigurators.get( "default" ); - } - return mojoExecutionConfigurator; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java deleted file mode 100644 index 3024fe45..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.Lifecycle; -import org.apache.maven.lifecycle.LifecycleMappingDelegate; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.plugin.BuildPluginManager; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -@Component( role = LifecycleMappingDelegate.class, hint = DefaultLifecycleMappingDelegate.HINT ) -public class DefaultLifecycleMappingDelegate - implements LifecycleMappingDelegate -{ - public static final String HINT = "default"; - - @Requirement - private BuildPluginManager pluginManager; - - public Map<String, List<MojoExecution>> calculateLifecycleMappings( MavenSession session, MavenProject project, - Lifecycle lifecycle, String lifecyclePhase ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, InvalidPluginDescriptorException - { - /* - * Initialize mapping from lifecycle phase to bound mojos. The key set of this map denotes the phases the caller - * is interested in, i.e. all phases up to and including the specified phase. - */ - - Map<String, Map<Integer, List<MojoExecution>>> mappings = - new LinkedHashMap<String, Map<Integer, List<MojoExecution>>>(); - - for ( String phase : lifecycle.getPhases() ) - { - Map<Integer, List<MojoExecution>> phaseBindings = new TreeMap<Integer, List<MojoExecution>>(); - - mappings.put( phase, phaseBindings ); - - if ( phase.equals( lifecyclePhase ) ) - { - break; - } - } - - /* - * Grab plugin executions that are bound to the selected lifecycle phases from project. The effective model of - * the project already contains the plugin executions induced by the project's packaging type. Remember, all - * phases of interest and only those are in the lifecyle mapping, if a phase has no value in the map, we are not - * interested in any of the executions bound to it. - */ - - for ( Plugin plugin : project.getBuild().getPlugins() ) - { - for ( PluginExecution execution : plugin.getExecutions() ) - { - // if the phase is specified then I don't have to go fetch the plugin yet and pull it down - // to examine the phase it is associated to. - if ( execution.getPhase() != null ) - { - Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( execution.getPhase() ); - if ( phaseBindings != null ) - { - for ( String goal : execution.getGoals() ) - { - MojoExecution mojoExecution = new MojoExecution( plugin, goal, execution.getId() ); - mojoExecution.setLifecyclePhase( execution.getPhase() ); - addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() ); - } - } - } - // if not then i need to grab the mojo descriptor and look at the phase that is specified - else - { - for ( String goal : execution.getGoals() ) - { - MojoDescriptor mojoDescriptor = - pluginManager.getMojoDescriptor( plugin, goal, project.getRemotePluginRepositories(), - session.getRepositorySession() ); - - Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( mojoDescriptor.getPhase() ); - if ( phaseBindings != null ) - { - MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, execution.getId() ); - mojoExecution.setLifecyclePhase( mojoDescriptor.getPhase() ); - addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() ); - } - } - } - } - } - - Map<String, List<MojoExecution>> lifecycleMappings = new LinkedHashMap<String, List<MojoExecution>>(); - - for ( Map.Entry<String, Map<Integer, List<MojoExecution>>> entry : mappings.entrySet() ) - { - List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>(); - - for ( List<MojoExecution> executions : entry.getValue().values() ) - { - mojoExecutions.addAll( executions ); - } - - lifecycleMappings.put( entry.getKey(), mojoExecutions ); - } - - return lifecycleMappings; - - } - - private void addMojoExecution( Map<Integer, List<MojoExecution>> phaseBindings, MojoExecution mojoExecution, - int priority ) - { - List<MojoExecution> mojoExecutions = phaseBindings.get( priority ); - - if ( mojoExecutions == null ) - { - mojoExecutions = new ArrayList<MojoExecution>(); - phaseBindings.put( priority, mojoExecutions ); - } - - mojoExecutions.add( mojoExecution ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java deleted file mode 100644 index a5e6a34c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.lifecycle.DefaultLifecycles; -import org.apache.maven.lifecycle.LifeCyclePluginAnalyzer; -import org.apache.maven.lifecycle.Lifecycle; -import org.apache.maven.lifecycle.mapping.LifecycleMapping; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.StringUtils; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author jdcasey - * @author Kristian Rosenvold (extracted class only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = LifeCyclePluginAnalyzer.class ) -public class DefaultLifecyclePluginAnalyzer - implements LifeCyclePluginAnalyzer -{ - - @Requirement( role = LifecycleMapping.class ) - private Map<String, LifecycleMapping> lifecycleMappings; - - @Requirement - private DefaultLifecycles defaultLifeCycles; - - @Requirement - private Logger logger; - - public DefaultLifecyclePluginAnalyzer() - { - } - - // These methods deal with construction intact Plugin object that look like they come from a standard - // <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information - // together and this really shows the problem of constructing a sensible default configuration but - // it's all encapsulated here so it appears normalized to the POM builder. - - // We are going to take the project packaging and find all plugin in the default lifecycle and create - // fully populated Plugin objects, including executions with goals and default configuration taken - // from the plugin.xml inside a plugin. - // - - public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging ) - { - if ( logger.isDebugEnabled() ) - { - logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from " - + Thread.currentThread().getContextClassLoader() ); - } - - LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging ); - - if ( lifecycleMappingForPackaging == null ) - { - return null; - } - - Map<Plugin, Plugin> plugins = new LinkedHashMap<Plugin, Plugin>(); - - for ( Lifecycle lifecycle : getOrderedLifecycles() ) - { - org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration = - lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() ); - - Map<String, String> phaseToGoalMapping = null; - - if ( lifecycleConfiguration != null ) - { - phaseToGoalMapping = lifecycleConfiguration.getPhases(); - } - else if ( lifecycle.getDefaultPhases() != null ) - { - phaseToGoalMapping = lifecycle.getDefaultPhases(); - } - - if ( phaseToGoalMapping != null ) - { - // These are of the form: - // - // compile -> org.apache.maven.plugins:maven-compiler-plugin:compile[,gid:aid:goal,...] - // - for ( Map.Entry<String, String> goalsForLifecyclePhase : phaseToGoalMapping.entrySet() ) - { - String phase = goalsForLifecyclePhase.getKey(); - String goals = goalsForLifecyclePhase.getValue(); - if ( goals != null ) - { - parseLifecyclePhaseDefinitions( plugins, phase, goals ); - } - } - } - } - - return plugins.keySet(); - } - - private List<Lifecycle> getOrderedLifecycles() - { - // NOTE: The lifecycle order can affect implied execution ids so we better be deterministic. - - List<Lifecycle> lifecycles = new ArrayList<Lifecycle>( defaultLifeCycles.getLifeCycles() ); - - Collections.sort( lifecycles, new Comparator<Lifecycle>() - { - - public int compare( Lifecycle l1, Lifecycle l2 ) - { - return l1.getId().compareTo( l2.getId() ); - } - - } ); - - return lifecycles; - } - - private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String phase, String goals ) - { - String[] mojos = StringUtils.split( goals, "," ); - - for ( int i = 0; i < mojos.length; i++ ) - { - GoalSpec gs = parseGoalSpec( mojos[i].trim() ); - - if ( gs == null ) - { - logger.warn( "Ignored invalid goal specification '" + mojos[i] + "' from lifecycle mapping for phase " - + phase ); - continue; - } - - Plugin plugin = new Plugin(); - plugin.setGroupId( gs.groupId ); - plugin.setArtifactId( gs.artifactId ); - plugin.setVersion( gs.version ); - - Plugin existing = plugins.get( plugin ); - if ( existing != null ) - { - if ( existing.getVersion() == null ) - { - existing.setVersion( plugin.getVersion() ); - } - plugin = existing; - } - else - { - plugins.put( plugin, plugin ); - } - - PluginExecution execution = new PluginExecution(); - execution.setId( getExecutionId( plugin, gs.goal ) ); - execution.setPhase( phase ); - execution.setPriority( i - mojos.length ); - execution.getGoals().add( gs.goal ); - - plugin.getExecutions().add( execution ); - } - } - - private GoalSpec parseGoalSpec( String goalSpec ) - { - GoalSpec gs = new GoalSpec(); - - String[] p = StringUtils.split( goalSpec.trim(), ":" ); - - if ( p.length == 3 ) - { - // <groupId>:<artifactId>:<goal> - gs.groupId = p[0]; - gs.artifactId = p[1]; - gs.goal = p[2]; - } - else if ( p.length == 4 ) - { - // <groupId>:<artifactId>:<version>:<goal> - gs.groupId = p[0]; - gs.artifactId = p[1]; - gs.version = p[2]; - gs.goal = p[3]; - } - else - { - // invalid - gs = null; - } - - return gs; - } - - private String getExecutionId( Plugin plugin, String goal ) - { - Set<String> existingIds = new HashSet<String>(); - for ( PluginExecution execution : plugin.getExecutions() ) - { - existingIds.add( execution.getId() ); - } - - String base = "default-" + goal; - String id = base; - - for ( int index = 1; existingIds.contains( id ); index++ ) - { - id = base + '-' + index; - } - - return id; - } - - static class GoalSpec - { - - String groupId; - - String artifactId; - - String version; - - String goal; - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java deleted file mode 100644 index 28377f1d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleNotFoundException; -import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.StringUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Calculates the task segments in the build - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author jdcasey - * @author Kristian Rosenvold (extracted class) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ - -@Component( role = LifecycleTaskSegmentCalculator.class ) -public class DefaultLifecycleTaskSegmentCalculator - implements LifecycleTaskSegmentCalculator -{ - @Requirement - private MojoDescriptorCreator mojoDescriptorCreator; - - @Requirement - private LifecyclePluginResolver lifecyclePluginResolver; - - public DefaultLifecycleTaskSegmentCalculator() - { - } - - public List<TaskSegment> calculateTaskSegments( MavenSession session ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException - { - - MavenProject rootProject = session.getTopLevelProject(); - - List<String> tasks = session.getGoals(); - - if ( ( tasks == null || tasks.isEmpty() ) && !StringUtils.isEmpty( rootProject.getDefaultGoal() ) ) - { - tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) ); - } - - return calculateTaskSegments( session, tasks ); - } - - public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException - { - List<TaskSegment> taskSegments = new ArrayList<TaskSegment>( tasks.size() ); - - TaskSegment currentSegment = null; - - for ( String task : tasks ) - { - if ( isGoalSpecification( task ) ) - { - // "pluginPrefix:goal" or "groupId:artifactId[:version]:goal" - - lifecyclePluginResolver.resolveMissingPluginVersions( session.getTopLevelProject(), session ); - - MojoDescriptor mojoDescriptor = - mojoDescriptorCreator.getMojoDescriptor( task, session, session.getTopLevelProject() ); - - boolean aggregating = mojoDescriptor.isAggregator() || !mojoDescriptor.isProjectRequired(); - - if ( currentSegment == null || currentSegment.isAggregating() != aggregating ) - { - currentSegment = new TaskSegment( aggregating ); - taskSegments.add( currentSegment ); - } - - currentSegment.getTasks().add( new GoalTask( task ) ); - } - else - { - // lifecycle phase - - if ( currentSegment == null || currentSegment.isAggregating() ) - { - currentSegment = new TaskSegment( false ); - taskSegments.add( currentSegment ); - } - - currentSegment.getTasks().add( new LifecycleTask( task ) ); - } - } - - return taskSegments; - } - - public boolean requiresProject( MavenSession session ) - { - List<String> goals = session.getGoals(); - if ( goals != null ) - { - for ( String goal : goals ) - { - if ( !isGoalSpecification( goal ) ) - { - return true; - } - } - } - return false; - } - - - private boolean isGoalSpecification( String task ) - { - return task.indexOf( ':' ) >= 0; - } - -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java deleted file mode 100644 index 176ba320..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Collection; - -import org.apache.maven.lifecycle.MojoExecutionConfigurator; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; - -/** - * @since 3.3.1, MNG-5753 - */ -@Component( role = MojoExecutionConfigurator.class ) -public class DefaultMojoExecutionConfigurator - implements MojoExecutionConfigurator -{ - - @Override - public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig ) - { - String g = mojoExecution.getGroupId(); - - String a = mojoExecution.getArtifactId(); - - Plugin plugin = findPlugin( g, a, project.getBuildPlugins() ); - - if ( plugin == null && project.getPluginManagement() != null ) - { - plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() ); - } - - if ( plugin != null ) - { - PluginExecution pluginExecution = - findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() ); - - Xpp3Dom pomConfiguration = null; - - if ( pluginExecution != null ) - { - pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration(); - } - else if ( allowPluginLevelConfig ) - { - pomConfiguration = (Xpp3Dom) plugin.getConfiguration(); - } - - Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null; - - mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration ); - - mojoExecution.setConfiguration( mojoConfiguration ); - } - } - - private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins ) - { - for ( Plugin plugin : plugins ) - { - if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) ) - { - return plugin; - } - } - - return null; - } - - private PluginExecution findPluginExecution( String executionId, Collection<PluginExecution> executions ) - { - if ( StringUtils.isNotEmpty( executionId ) ) - { - for ( PluginExecution execution : executions ) - { - if ( executionId.equals( execution.getId() ) ) - { - return execution; - } - } - } - - return null; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java deleted file mode 100644 index 762fc72b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Set; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.apache.maven.project.artifact.MavenMetadataSource; - -@SuppressWarnings( "deprecation" ) -@Named -public class DefaultProjectArtifactFactory - implements ProjectArtifactFactory -{ - private final ArtifactFactory artifactFactory; - - @Inject - public DefaultProjectArtifactFactory( ArtifactFactory artifactFactory ) - { - this.artifactFactory = artifactFactory; - } - - @Override - public Set<Artifact> createArtifacts( MavenProject project ) - throws InvalidDependencyVersionException - { - return MavenMetadataSource.createArtifacts( artifactFactory, project.getDependencies(), null, null, project ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java deleted file mode 100644 index 18fae7a9..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.project.MavenProject; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.TreeSet; - -/** - * Context of dependency artifacts for a particular project. - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (class extract only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -// TODO: From a concurrency perspective, this class is not good. The combination of mutable/immutable state is not nice -public class DependencyContext -{ - - private static final Collection<?> UNRESOLVED = Arrays.asList(); - - private final MavenProject project; - - private final Collection<String> scopesToCollectForCurrentProject; - - private final Collection<String> scopesToResolveForCurrentProject; - - private final Collection<String> scopesToCollectForAggregatedProjects; - - private final Collection<String> scopesToResolveForAggregatedProjects; - - private volatile Collection<?> lastDependencyArtifacts = UNRESOLVED; - - private volatile int lastDependencyArtifactCount = -1; - - public DependencyContext( MavenProject project, Collection<String> scopesToCollect, - Collection<String> scopesToResolve ) - { - this.project = project; - scopesToCollectForCurrentProject = scopesToCollect; - scopesToResolveForCurrentProject = scopesToResolve; - scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() ); - scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() ); - } - - public MavenProject getProject() - { - return project; - } - - public Collection<String> getScopesToCollectForCurrentProject() - { - return scopesToCollectForCurrentProject; - } - - public Collection<String> getScopesToResolveForCurrentProject() - { - return scopesToResolveForCurrentProject; - } - - public Collection<String> getScopesToCollectForAggregatedProjects() - { - return scopesToCollectForAggregatedProjects; - } - - public Collection<String> getScopesToResolveForAggregatedProjects() - { - return scopesToResolveForAggregatedProjects; - } - - public boolean isResolutionRequiredForCurrentProject() - { - return lastDependencyArtifacts != project.getDependencyArtifacts() || ( lastDependencyArtifacts != null - && lastDependencyArtifactCount != lastDependencyArtifacts.size() ); - } - - public boolean isResolutionRequiredForAggregatedProjects( Collection<String> scopesToCollect, - Collection<String> scopesToResolve ) - { - boolean required = - scopesToCollectForAggregatedProjects.addAll( scopesToCollect ) - || scopesToResolveForAggregatedProjects.addAll( scopesToResolve ); - return required; - } - - public void synchronizeWithProjectState() - { - lastDependencyArtifacts = project.getDependencyArtifacts(); - lastDependencyArtifactCount = ( lastDependencyArtifacts != null ) ? lastDependencyArtifacts.size() : 0; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java deleted file mode 100644 index acff5661..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.ExecutionEvent; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecution; - -/** - * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility interface that is only - * public for technical reasons, it is not part of the public API. In particular, this interface can be changed or - * deleted without prior notice. - * - * @author Benjamin Bentmann - */ -public interface ExecutionEventCatapult -{ - - void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution ); - - void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution, Exception exception ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java deleted file mode 100644 index cceffdf8..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.project.MavenProject; - -import java.util.ArrayList; -import java.util.List; - -/** - * Wraps individual MojoExecutions, containing information about completion status and scheduling. - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - * - * @since 3.0 - * @author Kristian Rosenvold - */ -public class ExecutionPlanItem -{ - private final MojoExecution mojoExecution; - - public ExecutionPlanItem( MojoExecution mojoExecution ) - { - this.mojoExecution = mojoExecution; - } - - public static List<ExecutionPlanItem> createExecutionPlanItems( MavenProject mavenProject, - List<MojoExecution> executions ) - { - BuilderCommon.attachToThread( mavenProject ); - - List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>(); - for ( MojoExecution mojoExecution : executions ) - { - result.add( new ExecutionPlanItem( mojoExecution ) ); - } - return result; - } - - public MojoExecution getMojoExecution() - { - return mojoExecution; - } - - public String getLifecyclePhase() - { - return mojoExecution.getLifecyclePhase(); - } - - public Plugin getPlugin() - { - final MojoDescriptor mojoDescriptor = getMojoExecution().getMojoDescriptor(); - return mojoDescriptor.getPluginDescriptor().getPlugin(); - } - - @Override - public String toString() - { - return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + '}' - + super.toString(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java deleted file mode 100644 index 5c43dbd4..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -/** - * A task that is a goal - * <p/> - * TODO: From a concurrecy perspective, this class is not good. The combination of mutable/immutable state is not nice - * - * @since 3.0 - * @author Benjamin Bentmann - */ -public final class GoalTask -{ - - final String pluginGoal; - - public GoalTask( String pluginGoal ) - { - this.pluginGoal = pluginGoal; - } - - @Override - public String toString() - { - return pluginGoal; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java deleted file mode 100644 index 2edbe754..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.lifecycle.MavenExecutionPlan; -import org.apache.maven.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.StringUtils; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -/** - * Logs debug output from the various lifecycle phases. - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author Kristian Rosenvold (extracted class only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = LifecycleDebugLogger.class ) -public class LifecycleDebugLogger -{ - @Requirement - private Logger logger; - - - public LifecycleDebugLogger() - { - } - - public LifecycleDebugLogger( Logger logger ) - { - this.logger = logger; - } - - - public void debug( String s ) - { - logger.debug( s ); - } - - public void info( String s ) - { - logger.info( s ); - } - - public void debugReactorPlan( ProjectBuildList projectBuilds ) - { - if ( !logger.isDebugEnabled() ) - { - return; - } - - logger.debug( "=== REACTOR BUILD PLAN ================================================" ); - - for ( Iterator<ProjectSegment> it = projectBuilds.iterator(); it.hasNext(); ) - { - ProjectSegment projectBuild = it.next(); - - logger.debug( "Project: " + projectBuild.getProject().getId() ); - logger.debug( "Tasks: " + projectBuild.getTaskSegment().getTasks() ); - logger.debug( "Style: " + ( projectBuild.getTaskSegment().isAggregating() ? "Aggregating" : "Regular" ) ); - - if ( it.hasNext() ) - { - logger.debug( "-----------------------------------------------------------------------" ); - } - } - - logger.debug( "=======================================================================" ); - } - - - public void debugProjectPlan( MavenProject currentProject, MavenExecutionPlan executionPlan ) - { - if ( !logger.isDebugEnabled() ) - { - return; - } - - logger.debug( "=== PROJECT BUILD PLAN ================================================" ); - logger.debug( "Project: " + BuilderCommon.getKey( currentProject ) ); - - debugDependencyRequirements( executionPlan.getMojoExecutions() ); - - logger.debug( "Repositories (dependencies): " + currentProject.getRemoteProjectRepositories() ); - logger.debug( "Repositories (plugins) : " + currentProject.getRemotePluginRepositories() ); - - for ( ExecutionPlanItem mojoExecution : executionPlan ) - { - debugMojoExecution( mojoExecution.getMojoExecution() ); - } - - logger.debug( "=======================================================================" ); - } - - private void debugMojoExecution( MojoExecution mojoExecution ) - { - String mojoExecId = - mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':' - + mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')'; - - Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions(); - if ( !forkedExecutions.isEmpty() ) - { - for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() ) - { - logger.debug( "--- init fork of " + fork.getKey() + " for " + mojoExecId + " ---" ); - - debugDependencyRequirements( fork.getValue() ); - - for ( MojoExecution forkedExecution : fork.getValue() ) - { - debugMojoExecution( forkedExecution ); - } - - logger.debug( "--- exit fork of " + fork.getKey() + " for " + mojoExecId + " ---" ); - } - } - - logger.debug( "-----------------------------------------------------------------------" ); - logger.debug( "Goal: " + mojoExecId ); - logger.debug( - "Style: " + ( mojoExecution.getMojoDescriptor().isAggregator() ? "Aggregating" : "Regular" ) ); - logger.debug( "Configuration: " + mojoExecution.getConfiguration() ); - } - - private void debugDependencyRequirements( List<MojoExecution> mojoExecutions ) - { - Set<String> scopesToCollect = new TreeSet<String>(); - Set<String> scopesToResolve = new TreeSet<String>(); - - for ( MojoExecution mojoExecution : mojoExecutions ) - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired(); - if ( StringUtils.isNotEmpty( scopeToCollect ) ) - { - scopesToCollect.add( scopeToCollect ); - } - - String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired(); - if ( StringUtils.isNotEmpty( scopeToResolve ) ) - { - scopesToResolve.add( scopeToResolve ); - } - } - - logger.debug( "Dependencies (collect): " + scopesToCollect ); - logger.debug( "Dependencies (resolve): " + scopesToResolve ); - } - -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java deleted file mode 100644 index 4d73528c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.eventspy.internal.EventSpyDispatcher; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleExecutionException; -import org.apache.maven.project.DefaultDependencyResolutionRequest; -import org.apache.maven.project.DependencyResolutionException; -import org.apache.maven.project.DependencyResolutionResult; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectDependenciesResolver; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.codehaus.plexus.logging.Logger; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.DependencyFilter; -import org.eclipse.aether.graph.DependencyNode; -import org.eclipse.aether.util.filter.AndDependencyFilter; -import org.eclipse.aether.util.filter.ScopeDependencyFilter; - -/** - * Resolves dependencies for the artifacts in context of the lifecycle build - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author Kristian Rosenvold (extracted class) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Named -public class LifecycleDependencyResolver -{ - - @Inject - private ProjectDependenciesResolver dependenciesResolver; - - @Inject - private Logger logger; - - @Inject - private ProjectArtifactFactory artifactFactory; - - @Inject - private EventSpyDispatcher eventSpyDispatcher; - - public LifecycleDependencyResolver() - { - } - - public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger ) - { - this.dependenciesResolver = projectDependenciesResolver; - this.logger = logger; - } - - public static List<MavenProject> getProjects( MavenProject project, MavenSession session, boolean aggregator ) - { - if ( aggregator ) - { - return session.getProjects(); - } - else - { - return Collections.singletonList( project ); - } - } - - public void resolveProjectDependencies( MavenProject project, Collection<String> scopesToCollect, - Collection<String> scopesToResolve, MavenSession session, - boolean aggregating, Set<Artifact> projectArtifacts ) - throws LifecycleExecutionException - { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - try - { - ClassLoader projectRealm = project.getClassRealm(); - if ( projectRealm != null && projectRealm != tccl ) - { - Thread.currentThread().setContextClassLoader( projectRealm ); - } - - if ( project.getDependencyArtifacts() == null ) - { - try - { - project.setDependencyArtifacts( artifactFactory.createArtifacts( project ) ); - } - catch ( InvalidDependencyVersionException e ) - { - throw new LifecycleExecutionException( e ); - } - } - - Set<Artifact> artifacts = - getDependencies( project, scopesToCollect, scopesToResolve, session, aggregating, projectArtifacts ); - - project.setResolvedArtifacts( artifacts ); - - Map<String, Artifact> map = new HashMap<String, Artifact>(); - for ( Artifact artifact : artifacts ) - { - map.put( artifact.getDependencyConflictId(), artifact ); - } - for ( Artifact artifact : project.getDependencyArtifacts() ) - { - if ( artifact.getFile() == null ) - { - Artifact resolved = map.get( artifact.getDependencyConflictId() ); - if ( resolved != null ) - { - artifact.setFile( resolved.getFile() ); - artifact.setDependencyTrail( resolved.getDependencyTrail() ); - artifact.setResolvedVersion( resolved.getVersion() ); - artifact.setResolved( true ); - } - } - } - } - finally - { - Thread.currentThread().setContextClassLoader( tccl ); - } - } - - private Set<Artifact> getDependencies( MavenProject project, Collection<String> scopesToCollect, - Collection<String> scopesToResolve, MavenSession session, - boolean aggregating, Set<Artifact> projectArtifacts ) - throws LifecycleExecutionException - { - if ( scopesToCollect == null ) - { - scopesToCollect = Collections.emptySet(); - } - if ( scopesToResolve == null ) - { - scopesToResolve = Collections.emptySet(); - } - - if ( scopesToCollect.isEmpty() && scopesToResolve.isEmpty() ) - { - return new LinkedHashSet<Artifact>(); - } - - scopesToCollect = new HashSet<String>( scopesToCollect ); - scopesToCollect.addAll( scopesToResolve ); - - DependencyFilter collectionFilter = new ScopeDependencyFilter( null, negate( scopesToCollect ) ); - DependencyFilter resolutionFilter = new ScopeDependencyFilter( null, negate( scopesToResolve ) ); - resolutionFilter = AndDependencyFilter.newInstance( collectionFilter, resolutionFilter ); - resolutionFilter = - AndDependencyFilter.newInstance( resolutionFilter, new ReactorDependencyFilter( projectArtifacts ) ); - - DependencyResolutionResult result; - try - { - DefaultDependencyResolutionRequest request = - new DefaultDependencyResolutionRequest( project, session.getRepositorySession() ); - request.setResolutionFilter( resolutionFilter ); - - eventSpyDispatcher.onEvent( request ); - - result = dependenciesResolver.resolve( request ); - } - catch ( DependencyResolutionException e ) - { - result = e.getResult(); - - /* - * MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator - * plugins that require dependency resolution although they usually run in phases of the build where project - * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare". - */ - if ( aggregating && areAllDependenciesInReactor( session.getProjects(), - result.getUnresolvedDependencies() ) ) - { - logger.warn( "The following dependencies could not be resolved at this point of the build" - + " but seem to be part of the reactor:" ); - - for ( Dependency dependency : result.getUnresolvedDependencies() ) - { - logger.warn( "o " + dependency ); - } - - logger.warn( "Try running the build up to the lifecycle phase \"package\"" ); - } - else - { - throw new LifecycleExecutionException( null, project, e ); - } - } - - eventSpyDispatcher.onEvent( result ); - - Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); - if ( result.getDependencyGraph() != null && !result.getDependencyGraph().getChildren().isEmpty() ) - { - RepositoryUtils.toArtifacts( artifacts, result.getDependencyGraph().getChildren(), - Collections.singletonList( project.getArtifact().getId() ), collectionFilter ); - } - return artifacts; - } - - private boolean areAllDependenciesInReactor( Collection<MavenProject> projects, - Collection<Dependency> dependencies ) - { - Set<String> projectKeys = getReactorProjectKeys( projects ); - - for ( Dependency dependency : dependencies ) - { - org.eclipse.aether.artifact.Artifact a = dependency.getArtifact(); - String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() ); - if ( !projectKeys.contains( key ) ) - { - return false; - } - } - - return true; - } - - private Set<String> getReactorProjectKeys( Collection<MavenProject> projects ) - { - Set<String> projectKeys = new HashSet<String>( projects.size() * 2 ); - for ( MavenProject project : projects ) - { - String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ); - projectKeys.add( key ); - } - return projectKeys; - } - - private Collection<String> negate( Collection<String> scopes ) - { - Collection<String> result = new HashSet<String>(); - Collections.addAll( result, "system", "compile", "provided", "runtime", "test" ); - - for ( String scope : scopes ) - { - if ( "compile".equals( scope ) ) - { - result.remove( "compile" ); - result.remove( "system" ); - result.remove( "provided" ); - } - else if ( "runtime".equals( scope ) ) - { - result.remove( "compile" ); - result.remove( "runtime" ); - } - else if ( "compile+runtime".equals( scope ) ) - { - result.remove( "compile" ); - result.remove( "system" ); - result.remove( "provided" ); - result.remove( "runtime" ); - } - else if ( "runtime+system".equals( scope ) ) - { - result.remove( "compile" ); - result.remove( "system" ); - result.remove( "runtime" ); - } - else if ( "test".equals( scope ) ) - { - result.clear(); - } - } - - return result; - } - - private static class ReactorDependencyFilter - implements DependencyFilter - { - - private Set<String> keys = new HashSet<String>(); - - public ReactorDependencyFilter( Collection<Artifact> artifacts ) - { - for ( Artifact artifact : artifacts ) - { - String key = ArtifactUtils.key( artifact ); - keys.add( key ); - } - } - - public boolean accept( DependencyNode node, List<DependencyNode> parents ) - { - Dependency dependency = node.getDependency(); - if ( dependency != null ) - { - org.eclipse.aether.artifact.Artifact a = dependency.getArtifact(); - String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() ); - return !keys.contains( key ); - } - return false; - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java deleted file mode 100644 index 7d35b102..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleNotFoundException; -import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.project.MavenProject; - -import java.util.List; - -/** - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (extract interface only) - * <p/> - */ -public interface LifecycleExecutionPlanCalculator -{ - MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks ) - throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, - NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException; - - MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks, - boolean setup ) - throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, - NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException; - - void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session ) - throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, - PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException; - - void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException, - LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java deleted file mode 100644 index 343fbf95..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.HashSet; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.execution.BuildSuccess; -import org.apache.maven.execution.ExecutionEvent; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.execution.ProjectExecutionEvent; -import org.apache.maven.execution.ProjectExecutionListener; -import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.project.MavenProject; -import org.apache.maven.session.scope.internal.SessionScope; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * Builds one or more lifecycles for a full module - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author Kristian Rosenvold (extracted class) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = LifecycleModuleBuilder.class ) -public class LifecycleModuleBuilder -{ - - @Requirement - private MojoExecutor mojoExecutor; - - @Requirement - private BuilderCommon builderCommon; - - @Requirement - private ExecutionEventCatapult eventCatapult; - - private ProjectExecutionListener projectExecutionListener; - - // this tricks plexus-component-metadata generate required metadata - @Requirement - private List<ProjectExecutionListener> projectExecutionListeners; - - @Requirement - private SessionScope sessionScope; - - public void setProjectExecutionListeners( final List<ProjectExecutionListener> listeners ) - { - this.projectExecutionListeners = listeners; - this.projectExecutionListener = new CompoundProjectExecutionListener( listeners ); - } - - public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject, - TaskSegment taskSegment ) - { - buildProject( session, session, reactorContext, currentProject, taskSegment ); - } - - public void buildProject( MavenSession session, MavenSession rootSession, ReactorContext reactorContext, - MavenProject currentProject, TaskSegment taskSegment ) - { - session.setCurrentProject( currentProject ); - - long buildStartTime = System.currentTimeMillis(); - - // session may be different from rootSession seeded in DefaultMaven - // explicitly seed the right session here to make sure it is used by Guice - sessionScope.enter( reactorContext.getSessionScopeMemento() ); - sessionScope.seed( MavenSession.class, session ); - try - { - - if ( reactorContext.getReactorBuildStatus().isHaltedOrBlacklisted( currentProject ) ) - { - eventCatapult.fire( ExecutionEvent.Type.ProjectSkipped, session, null ); - return; - } - - BuilderCommon.attachToThread( currentProject ); - - projectExecutionListener.beforeProjectExecution( new ProjectExecutionEvent( session, currentProject ) ); - - eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, session, null ); - - MavenExecutionPlan executionPlan = - builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<Artifact>() ); - List<MojoExecution> mojoExecutions = executionPlan.getMojoExecutions(); - - projectExecutionListener.beforeProjectLifecycleExecution( new ProjectExecutionEvent( session, - currentProject, - mojoExecutions ) ); - mojoExecutor.execute( session, mojoExecutions, reactorContext.getProjectIndex() ); - - long buildEndTime = System.currentTimeMillis(); - - projectExecutionListener.afterProjectExecutionSuccess( new ProjectExecutionEvent( session, currentProject, - mojoExecutions ) ); - - reactorContext.getResult().addBuildSummary( new BuildSuccess( currentProject, - buildEndTime - buildStartTime ) ); - - eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, session, null ); - } - catch ( Throwable t ) - { - builderCommon.handleBuildError( reactorContext, rootSession, session, currentProject, t, buildStartTime ); - - projectExecutionListener.afterProjectExecutionFailure( new ProjectExecutionEvent( session, currentProject, - t ) ); - - // rethrow original errors and runtime exceptions - if ( t instanceof RuntimeException ) - { - throw (RuntimeException) t; - } - if ( t instanceof Error ) - { - throw (Error) t; - } - } - finally - { - sessionScope.exit(); - - session.setCurrentProject( null ); - - Thread.currentThread().setContextClassLoader( reactorContext.getOriginalContextClassLoader() ); - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java deleted file mode 100644 index c615a6f6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginManagement; -import org.apache.maven.plugin.version.DefaultPluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolver; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -import java.util.HashMap; -import java.util.Map; - -/** - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (Extract class) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = LifecyclePluginResolver.class ) -public class LifecyclePluginResolver -{ - @Requirement - private PluginVersionResolver pluginVersionResolver; - - - public LifecyclePluginResolver( PluginVersionResolver pluginVersionResolver ) - { - this.pluginVersionResolver = pluginVersionResolver; - } - - public LifecyclePluginResolver() - { - } - - public void resolveMissingPluginVersions( MavenProject project, MavenSession session ) - throws PluginVersionResolutionException - { - Map<String, String> versions = new HashMap<String, String>( 64 ); - - for ( Plugin plugin : project.getBuildPlugins() ) - { - if ( plugin.getVersion() == null ) - { - PluginVersionRequest request = - new DefaultPluginVersionRequest( plugin, session.getRepositorySession(), - project.getRemotePluginRepositories() ); - plugin.setVersion( pluginVersionResolver.resolve( request ).getVersion() ); - } - versions.put( plugin.getKey(), plugin.getVersion() ); - } - - PluginManagement pluginManagement = project.getPluginManagement(); - if ( pluginManagement != null ) - { - for ( Plugin plugin : pluginManagement.getPlugins() ) - { - if ( plugin.getVersion() == null ) - { - plugin.setVersion( versions.get( plugin.getKey() ) ); - if ( plugin.getVersion() == null ) - { - PluginVersionRequest request = - new DefaultPluginVersionRequest( plugin, session.getRepositorySession(), - project.getRemotePluginRepositories() ); - plugin.setVersion( pluginVersionResolver.resolve( request ).getVersion() ); - } - } - } - } - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java deleted file mode 100644 index cee80739..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; -import java.util.Map; - -import org.apache.maven.execution.ExecutionEvent; -import org.apache.maven.execution.MavenExecutionResult; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.DefaultLifecycles; -import org.apache.maven.lifecycle.MissingProjectException; -import org.apache.maven.lifecycle.NoGoalSpecifiedException; -import org.apache.maven.lifecycle.internal.builder.Builder; -import org.apache.maven.lifecycle.internal.builder.BuilderNotFoundException; -import org.apache.maven.session.scope.internal.SessionScope; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; - -/** - * Starts the build life cycle - * - * @author Jason van Zyl - * @author Benjamin Bentmann - * @author Kristian Rosenvold - */ -@Component( role = LifecycleStarter.class ) -public class LifecycleStarter -{ - @Requirement - private ExecutionEventCatapult eventCatapult; - - @Requirement - private DefaultLifecycles defaultLifeCycles; - - @Requirement - private Logger logger; - - @Requirement - private BuildListCalculator buildListCalculator; - - @Requirement - private LifecycleDebugLogger lifecycleDebugLogger; - - @Requirement - private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator; - - @Requirement - private Map<String, Builder> builders; - - @Requirement - private SessionScope sessionScope; - - public void execute( MavenSession session ) - { - eventCatapult.fire( ExecutionEvent.Type.SessionStarted, session, null ); - - ReactorContext reactorContext = null; - ProjectBuildList projectBuilds = null; - MavenExecutionResult result = session.getResult(); - - try - { - if ( buildExecutionRequiresProject( session ) && projectIsNotPresent( session ) ) - { - throw new MissingProjectException( "The goal you specified requires a project to execute" - + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." - + " Please verify you invoked Maven from the correct directory." ); - } - - List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session ); - projectBuilds = buildListCalculator.calculateProjectBuilds( session, taskSegments ); - - if ( projectBuilds.isEmpty() ) - { - throw new NoGoalSpecifiedException( "No goals have been specified for this build." - + " You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or" - + " <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>." - + " Available lifecycle phases are: " + defaultLifeCycles.getLifecyclePhaseList() + "." ); - } - - ProjectIndex projectIndex = new ProjectIndex( session.getProjects() ); - - if ( logger.isDebugEnabled() ) - { - lifecycleDebugLogger.debugReactorPlan( projectBuilds ); - } - - ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); - ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() ); - reactorContext = - new ReactorContext( result, projectIndex, oldContextClassLoader, reactorBuildStatus, - sessionScope.memento() ); - - String builderId = session.getRequest().getBuilderId(); - Builder builder = builders.get( builderId ); - if ( builder == null ) - { - throw new BuilderNotFoundException( String.format( "The builder requested using id = %s cannot be" - + " found", builderId ) ); - } - - int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency(); - if ( degreeOfConcurrency >= 2 ) - { - logger.info( "" ); - logger.info( String.format( "Using the %s implementation with a thread count of %d", - builder.getClass().getSimpleName(), degreeOfConcurrency ) ); - } - builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus ); - - } - catch ( Exception e ) - { - result.addException( e ); - } - finally - { - eventCatapult.fire( ExecutionEvent.Type.SessionEnded, session, null ); - } - } - - private boolean buildExecutionRequiresProject( MavenSession session ) - { - return lifecycleTaskSegmentCalculator.requiresProject( session ); - } - - private boolean projectIsNotPresent( MavenSession session ) - { - return !session.getRequest().isProjectPresent(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java deleted file mode 100644 index 0b5fff34..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -/** - * A task that is a lifecycle - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - * - * @since 3.0 - * @author Benjamin Bentmann - */ -public final class LifecycleTask -{ - - private final String lifecyclePhase; - - public LifecycleTask( String lifecyclePhase ) - { - this.lifecyclePhase = lifecyclePhase; - } - - @Override - public String toString() - { - return getLifecyclePhase(); - } - - public String getLifecyclePhase() - { - return lifecyclePhase; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java deleted file mode 100644 index a721355b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleNotFoundException; -import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; - -import java.util.List; - -/** - * Calculates the task segments in the build - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author jdcasey - * @author Kristian Rosenvold (extracted interface) - * <p/> - * NOTE: This interface is not part of any public api and can be changed or deleted without prior notice. - */ - -public interface LifecycleTaskSegmentCalculator -{ - List<TaskSegment> calculateTaskSegments( MavenSession session ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException; - - List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException; - - boolean requiresProject( MavenSession session ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java deleted file mode 100644 index 36c85fdd..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java +++ /dev/null @@ -1,309 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.BuildPluginManager; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.prefix.DefaultPluginPrefixRequest; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.prefix.PluginPrefixRequest; -import org.apache.maven.plugin.prefix.PluginPrefixResolver; -import org.apache.maven.plugin.prefix.PluginPrefixResult; -import org.apache.maven.plugin.version.DefaultPluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolver; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.configuration.PlexusConfiguration; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.xml.Xpp3Dom; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.StringTokenizer; - -/** - * Resolves dependencies for the artifacts in context of the lifecycle build - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Jason van Zyl - * @author jdcasey - * @author Kristian Rosenvold (extracted class only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = MojoDescriptorCreator.class ) -public class MojoDescriptorCreator -{ - - @Requirement - private Logger logger; - - @Requirement - private PluginVersionResolver pluginVersionResolver; - - @Requirement - private BuildPluginManager pluginManager; - - @Requirement - private PluginPrefixResolver pluginPrefixResolver; - - @Requirement - private LifecyclePluginResolver lifecyclePluginResolver; - - public MojoDescriptorCreator() - { - } - - public MojoDescriptorCreator( PluginVersionResolver pluginVersionResolver, BuildPluginManager pluginManager, - PluginPrefixResolver pluginPrefixResolver, - LifecyclePluginResolver lifecyclePluginResolver ) - { - this.pluginVersionResolver = pluginVersionResolver; - this.pluginManager = pluginManager; - this.pluginPrefixResolver = pluginPrefixResolver; - this.lifecyclePluginResolver = lifecyclePluginResolver; - } - - private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins ) - { - for ( Plugin plugin : plugins ) - { - if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) ) - { - return plugin; - } - } - - return null; - } - - public static Xpp3Dom convert( MojoDescriptor mojoDescriptor ) - { - Xpp3Dom dom = new Xpp3Dom( "configuration" ); - - PlexusConfiguration c = mojoDescriptor.getMojoConfiguration(); - - PlexusConfiguration[] ces = c.getChildren(); - - if ( ces != null ) - { - for ( PlexusConfiguration ce : ces ) - { - String value = ce.getValue( null ); - String defaultValue = ce.getAttribute( "default-value", null ); - if ( value != null || defaultValue != null ) - { - Xpp3Dom e = new Xpp3Dom( ce.getName() ); - e.setValue( value ); - if ( defaultValue != null ) - { - e.setAttribute( "default-value", defaultValue ); - } - dom.addChild( e ); - } - } - } - - return dom; - } - - // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId - - public MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, - MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, - PluginVersionResolutionException - { - String goal = null; - - Plugin plugin = null; - - StringTokenizer tok = new StringTokenizer( task, ":" ); - - int numTokens = tok.countTokens(); - - if ( numTokens >= 4 ) - { - // We have everything that we need - // - // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process - // - // groupId - // artifactId - // version - // goal - // - plugin = new Plugin(); - plugin.setGroupId( tok.nextToken() ); - plugin.setArtifactId( tok.nextToken() ); - plugin.setVersion( tok.nextToken() ); - goal = tok.nextToken(); - - // This won't be valid, but it constructs something easy to read in the error message - while ( tok.hasMoreTokens() ) - { - goal += ":" + tok.nextToken(); - } - } - else if ( numTokens == 3 ) - { - // We have everything that we need except the version - // - // org.apache.maven.plugins:maven-remote-resources-plugin:???:process - // - // groupId - // artifactId - // ??? - // goal - // - plugin = new Plugin(); - plugin.setGroupId( tok.nextToken() ); - plugin.setArtifactId( tok.nextToken() ); - goal = tok.nextToken(); - } - else if ( numTokens <= 2 ) - { - // We have a prefix and goal - // - // idea:idea - // - String prefix = tok.nextToken(); - - if ( numTokens == 2 ) - { - goal = tok.nextToken(); - } - else - { - // goal was missing - pass through to MojoNotFoundException - goal = ""; - } - - // This is the case where someone has executed a single goal from the command line - // of the form: - // - // mvn remote-resources:process - // - // From the metadata stored on the server which has been created as part of a standard - // Maven plugin deployment we will find the right PluginDescriptor from the remote - // repository. - - plugin = findPluginForPrefix( prefix, session ); - } - - int executionIdx = goal.indexOf( '@' ); - if ( executionIdx > 0 ) - { - goal = goal.substring( 0, executionIdx ); - } - - injectPluginDeclarationFromProject( plugin, project ); - - // If there is no version to be found then we need to look in the repository metadata for - // this plugin and see what's specified as the latest release. - // - if ( plugin.getVersion() == null ) - { - resolvePluginVersion( plugin, session, project ); - } - - return pluginManager.getMojoDescriptor( plugin, goal, project.getRemotePluginRepositories(), - session.getRepositorySession() ); - } - - // TODO: take repo mans into account as one may be aggregating prefixes of many - // TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing - // or the user forces the issue - - public Plugin findPluginForPrefix( String prefix, MavenSession session ) - throws NoPluginFoundForPrefixException - { - // [prefix]:[goal] - - if ( session.getCurrentProject() != null ) - { - try - { - lifecyclePluginResolver.resolveMissingPluginVersions( session.getCurrentProject(), session ); - } - catch ( PluginVersionResolutionException e ) - { - // not critical here - logger.debug( e.getMessage(), e ); - } - } - - PluginPrefixRequest prefixRequest = new DefaultPluginPrefixRequest( prefix, session ); - PluginPrefixResult prefixResult = pluginPrefixResolver.resolve( prefixRequest ); - - Plugin plugin = new Plugin(); - plugin.setGroupId( prefixResult.getGroupId() ); - plugin.setArtifactId( prefixResult.getArtifactId() ); - - return plugin; - } - - private void resolvePluginVersion( Plugin plugin, MavenSession session, MavenProject project ) - throws PluginVersionResolutionException - { - PluginVersionRequest versionRequest = - new DefaultPluginVersionRequest( plugin, session.getRepositorySession(), - project.getRemotePluginRepositories() ); - plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() ); - } - - private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project ) - { - Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() ); - - if ( pluginInPom == null && project.getPluginManagement() != null ) - { - pluginInPom = findPlugin( plugin, project.getPluginManagement().getPlugins() ); - } - - if ( pluginInPom != null ) - { - if ( plugin.getVersion() == null ) - { - plugin.setVersion( pluginInPom.getVersion() ); - } - - plugin.setDependencies( new ArrayList<Dependency>( pluginInPom.getDependencies() ) ); - } - } - - private Plugin findPlugin( Plugin plugin, Collection<Plugin> plugins ) - { - return findPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugins ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java deleted file mode 100644 index a6ba752c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java +++ /dev/null @@ -1,394 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter; -import org.apache.maven.execution.ExecutionEvent; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleExecutionException; -import org.apache.maven.lifecycle.MissingProjectException; -import org.apache.maven.plugin.BuildPluginManager; -import org.apache.maven.plugin.MavenPluginManager; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.PluginConfigurationException; -import org.apache.maven.plugin.PluginIncompatibleException; -import org.apache.maven.plugin.PluginManagerException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.StringUtils; - -/** - * Executes an individual mojo - * - * @since 3.0 - * @author Jason van Zyl - * @author Benjamin Bentmann - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = MojoExecutor.class ) -public class MojoExecutor -{ - - @Requirement - private BuildPluginManager pluginManager; - - @Requirement - private MavenPluginManager mavenPluginManager; - - @Requirement - private LifecycleDependencyResolver lifeCycleDependencyResolver; - - @Requirement - private ExecutionEventCatapult eventCatapult; - - public MojoExecutor() - { - } - - public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions ) - { - Set<String> scopesToCollect = new TreeSet<String>(); - Set<String> scopesToResolve = new TreeSet<String>(); - - collectDependencyRequirements( scopesToResolve, scopesToCollect, mojoExecutions ); - - return new DependencyContext( session.getCurrentProject(), scopesToCollect, scopesToResolve ); - } - - private void collectDependencyRequirements( Set<String> scopesToResolve, Set<String> scopesToCollect, - Collection<MojoExecution> mojoExecutions ) - { - for ( MojoExecution mojoExecution : mojoExecutions ) - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - scopesToResolve.addAll( toScopes( mojoDescriptor.getDependencyResolutionRequired() ) ); - - scopesToCollect.addAll( toScopes( mojoDescriptor.getDependencyCollectionRequired() ) ); - } - } - - private Collection<String> toScopes( String classpath ) - { - if ( StringUtils.isNotEmpty( classpath ) ) - { - if ( Artifact.SCOPE_COMPILE.equals( classpath ) ) - { - return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED ); - } - else if ( Artifact.SCOPE_RUNTIME.equals( classpath ) ) - { - return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME ); - } - else if ( Artifact.SCOPE_COMPILE_PLUS_RUNTIME.equals( classpath ) ) - { - return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED, - Artifact.SCOPE_RUNTIME ); - } - else if ( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals( classpath ) ) - { - return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_RUNTIME ); - } - else if ( Artifact.SCOPE_TEST.equals( classpath ) ) - { - return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED, - Artifact.SCOPE_RUNTIME, Artifact.SCOPE_TEST ); - } - } - return Collections.emptyList(); - } - - public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex ) - throws LifecycleExecutionException - - { - DependencyContext dependencyContext = newDependencyContext( session, mojoExecutions ); - - PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() ); - - for ( MojoExecution mojoExecution : mojoExecutions ) - { - execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder ); - } - } - - public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex, - DependencyContext dependencyContext, PhaseRecorder phaseRecorder ) - throws LifecycleExecutionException - { - execute( session, mojoExecution, projectIndex, dependencyContext ); - phaseRecorder.observeExecution( mojoExecution ); - } - - private void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex, - DependencyContext dependencyContext ) - throws LifecycleExecutionException - { - MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - - try - { - mavenPluginManager.checkRequiredMavenVersion( mojoDescriptor.getPluginDescriptor() ); - } - catch ( PluginIncompatibleException e ) - { - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e ); - } - - if ( mojoDescriptor.isProjectRequired() && !session.getRequest().isProjectPresent() ) - { - Throwable cause = - new MissingProjectException( "Goal requires a project to execute" - + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." - + " Please verify you invoked Maven from the correct directory." ); - throw new LifecycleExecutionException( mojoExecution, null, cause ); - } - - if ( mojoDescriptor.isOnlineRequired() && session.isOffline() ) - { - if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) ) - { - Throwable cause = - new IllegalStateException( "Goal requires online mode for execution" - + " but Maven is currently offline." ); - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), cause ); - } - else - { - eventCatapult.fire( ExecutionEvent.Type.MojoSkipped, session, mojoExecution ); - - return; - } - } - - List<MavenProject> forkedProjects = executeForkedExecutions( mojoExecution, session, projectIndex ); - - ensureDependenciesAreResolved( mojoDescriptor, session, dependencyContext ); - - eventCatapult.fire( ExecutionEvent.Type.MojoStarted, session, mojoExecution ); - - try - { - try - { - pluginManager.executeMojo( session, mojoExecution ); - } - catch ( MojoFailureException e ) - { - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e ); - } - catch ( MojoExecutionException e ) - { - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e ); - } - catch ( PluginConfigurationException e ) - { - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e ); - } - catch ( PluginManagerException e ) - { - throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e ); - } - - eventCatapult.fire( ExecutionEvent.Type.MojoSucceeded, session, mojoExecution ); - } - catch ( LifecycleExecutionException e ) - { - eventCatapult.fire( ExecutionEvent.Type.MojoFailed, session, mojoExecution, e ); - - throw e; - } - finally - { - for ( MavenProject forkedProject : forkedProjects ) - { - forkedProject.setExecutionProject( null ); - } - } - } - - public void ensureDependenciesAreResolved( MojoDescriptor mojoDescriptor, MavenSession session, - DependencyContext dependencyContext ) - throws LifecycleExecutionException - - { - MavenProject project = dependencyContext.getProject(); - boolean aggregating = mojoDescriptor.isAggregator(); - - if ( dependencyContext.isResolutionRequiredForCurrentProject() ) - { - Collection<String> scopesToCollect = dependencyContext.getScopesToCollectForCurrentProject(); - Collection<String> scopesToResolve = dependencyContext.getScopesToResolveForCurrentProject(); - - lifeCycleDependencyResolver.resolveProjectDependencies( project, scopesToCollect, scopesToResolve, session, - aggregating, Collections.<Artifact>emptySet() ); - - dependencyContext.synchronizeWithProjectState(); - } - - if ( aggregating ) - { - Collection<String> scopesToCollect = toScopes( mojoDescriptor.getDependencyCollectionRequired() ); - Collection<String> scopesToResolve = toScopes( mojoDescriptor.getDependencyResolutionRequired() ); - - if ( dependencyContext.isResolutionRequiredForAggregatedProjects( scopesToCollect, scopesToResolve ) ) - { - for ( MavenProject aggregatedProject : session.getProjects() ) - { - if ( aggregatedProject != project ) - { - lifeCycleDependencyResolver.resolveProjectDependencies( aggregatedProject, scopesToCollect, - scopesToResolve, session, aggregating, - Collections.<Artifact>emptySet() ); - } - } - } - } - - ArtifactFilter artifactFilter = getArtifactFilter( mojoDescriptor ); - List<MavenProject> projectsToResolve = - LifecycleDependencyResolver.getProjects( session.getCurrentProject(), session, - mojoDescriptor.isAggregator() ); - for ( MavenProject projectToResolve : projectsToResolve ) - { - projectToResolve.setArtifactFilter( artifactFilter ); - } - } - - private ArtifactFilter getArtifactFilter( MojoDescriptor mojoDescriptor ) - { - String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired(); - String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired(); - - List<String> scopes = new ArrayList<String>( 2 ); - if ( StringUtils.isNotEmpty( scopeToCollect ) ) - { - scopes.add( scopeToCollect ); - } - if ( StringUtils.isNotEmpty( scopeToResolve ) ) - { - scopes.add( scopeToResolve ); - } - - if ( scopes.isEmpty() ) - { - return null; - } - else - { - return new CumulativeScopeArtifactFilter( scopes ); - } - } - - public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session, - ProjectIndex projectIndex ) - throws LifecycleExecutionException - { - List<MavenProject> forkedProjects = Collections.emptyList(); - - Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions(); - - if ( !forkedExecutions.isEmpty() ) - { - eventCatapult.fire( ExecutionEvent.Type.ForkStarted, session, mojoExecution ); - - MavenProject project = session.getCurrentProject(); - - forkedProjects = new ArrayList<MavenProject>( forkedExecutions.size() ); - - try - { - for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() ) - { - String projectId = fork.getKey(); - - int index = projectIndex.getIndices().get( projectId ); - - MavenProject forkedProject = projectIndex.getProjects().get( projectId ); - - forkedProjects.add( forkedProject ); - - MavenProject executedProject = forkedProject.clone(); - - forkedProject.setExecutionProject( executedProject ); - - List<MojoExecution> mojoExecutions = fork.getValue(); - - if ( mojoExecutions.isEmpty() ) - { - continue; - } - - try - { - session.setCurrentProject( executedProject ); - session.getProjects().set( index, executedProject ); - projectIndex.getProjects().put( projectId, executedProject ); - - eventCatapult.fire( ExecutionEvent.Type.ForkedProjectStarted, session, mojoExecution ); - - execute( session, mojoExecutions, projectIndex ); - - eventCatapult.fire( ExecutionEvent.Type.ForkedProjectSucceeded, session, mojoExecution ); - } - catch ( LifecycleExecutionException e ) - { - eventCatapult.fire( ExecutionEvent.Type.ForkedProjectFailed, session, mojoExecution, e ); - - throw e; - } - finally - { - projectIndex.getProjects().put( projectId, forkedProject ); - session.getProjects().set( index, forkedProject ); - session.setCurrentProject( project ); - } - } - - eventCatapult.fire( ExecutionEvent.Type.ForkSucceeded, session, mojoExecution ); - } - catch ( LifecycleExecutionException e ) - { - eventCatapult.fire( ExecutionEvent.Type.ForkFailed, session, mojoExecution, e ); - - throw e; - } - } - - return forkedProjects; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java deleted file mode 100644 index a09a3cb9..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.plugin.MojoExecution; -import org.apache.maven.project.MavenProject; - -/** - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public class PhaseRecorder -{ - private String lastLifecyclePhase; - - private final MavenProject project; - - public PhaseRecorder( MavenProject project ) - { - this.project = project; - } - - public void observeExecution( MojoExecution mojoExecution ) - { - String lifecyclePhase = mojoExecution.getLifecyclePhase(); - - if ( lifecyclePhase != null ) - { - if ( lastLifecyclePhase == null ) - { - lastLifecyclePhase = lifecyclePhase; - } - else if ( !lifecyclePhase.equals( lastLifecyclePhase ) ) - { - project.addLifecyclePhase( lastLifecyclePhase ); - lastLifecyclePhase = lifecyclePhase; - } - } - - if ( lastLifecyclePhase != null ) - { - project.addLifecyclePhase( lastLifecyclePhase ); - } - } - - public boolean isDifferentPhase( MojoExecution nextMojoExecution ) - { - String lifecyclePhase = nextMojoExecution.getLifecyclePhase(); - if ( lifecyclePhase == null ) - { - return lastLifecyclePhase != null; - } - return !lifecyclePhase.equals( lastLifecyclePhase ); - - } - - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java deleted file mode 100644 index b4a81075..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; - -/** - * Component interface responsible for creation of MavenProject#dependencyArtifacts instances. - * - * @since 3.2.4 - * @provisional This interface is part of work in progress and can be changed or removed without notice. - */ -public interface ProjectArtifactFactory -{ - Set<Artifact> createArtifacts( MavenProject project ) - throws InvalidDependencyVersionException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java deleted file mode 100644 index 6c8fd50a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; - -/** - * A list of project segments, ordered so that all ProjectSegments from first TaskSegment come before any - * subsequent TaskSegments. - * - * @since 3.0 - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public class ProjectBuildList - implements Iterable<ProjectSegment> -{ - private final List<ProjectSegment> items; - - public ProjectBuildList( List<ProjectSegment> items ) - { - this.items = Collections.unmodifiableList( items ); - } - - // TODO: Optimize; or maybe just rewrite the whole way aggregating mojos are being run. - /** - * Returns aProjectBuildList that contains only items for the specified taskSegment - * @param taskSegment the requested tasksegment - * @return a project build list for the supplied task segment - */ - public ProjectBuildList getByTaskSegment( TaskSegment taskSegment ) - { - List<ProjectSegment> currentSegment = new ArrayList<ProjectSegment>(); - for ( ProjectSegment projectBuild : items ) - { - if ( taskSegment == projectBuild.getTaskSegment() ) - { // NOTE: There's no notion of taskSegment equality. - currentSegment.add( projectBuild ); - } - } - return new ProjectBuildList( currentSegment ); - } - - public Map<MavenProject, ProjectSegment> selectSegment( TaskSegment taskSegment ) - { - Map<MavenProject, ProjectSegment> result = new HashMap<MavenProject, ProjectSegment>(); - for ( ProjectSegment projectBuild : items ) - { - if ( taskSegment == projectBuild.getTaskSegment() ) - { // NOTE: There's no notion of taskSegment equality. - result.put( projectBuild.getProject(), projectBuild ); - } - } - return result; - } - - /** - * Finds the first ProjectSegment matching the supplied project - * @param mavenProject the requested project - * @return The projectSegment or null. - */ - public ProjectSegment findByMavenProject( MavenProject mavenProject ) - { - for ( ProjectSegment projectBuild : items ) - { - if ( mavenProject.equals( projectBuild.getProject() ) ) - { - return projectBuild; - } - } - return null; - } - - public Iterator<ProjectSegment> iterator() - { - return items.iterator(); - } - - public void closeAll() - { - for ( ProjectSegment item : items ) - { - MavenSession sessionForThisModule = item.getSession(); - sessionForThisModule.setCurrentProject( null ); - } - } - - public int size() - { - return items.size(); - } - - public ProjectSegment get( int index ) - { - return items.get( index ); - } - - public Set<String> getReactorProjectKeys() - { - Set<String> projectKeys = new HashSet<String>( items.size() * 2 ); - for ( ProjectSegment projectBuild : items ) - { - MavenProject project = projectBuild.getProject(); - String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ); - projectKeys.add( key ); - } - return projectKeys; - } - - - public boolean isEmpty() - { - return items.isEmpty(); - } - - /** - * @return a set of all the projects managed by the build - */ - public Set<MavenProject> getProjects() - { - Set<MavenProject> projects = new HashSet<MavenProject>(); - - for ( ProjectSegment s : items ) - { - projects.add( s.getProject() ); - } - return projects; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java deleted file mode 100644 index b1b1d186..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.project.MavenProject; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Provides the positional index of the project - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (extracted class only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -// Todo: Kristian wonders if this class really is necessary and if it overlaps other concepts. -public final class ProjectIndex -{ - - private final Map<String, MavenProject> projects; - - private final Map<String, Integer> indices; - - public ProjectIndex( List<MavenProject> projects ) - { - this.projects = new HashMap<String, MavenProject>( projects.size() * 2 ); - this.indices = new HashMap<String, Integer>( projects.size() * 2 ); - - for ( int i = 0; i < projects.size(); i++ ) - { - MavenProject project = projects.get( i ); - String key = BuilderCommon.getKey( project ); - - this.getProjects().put( key, project ); - this.getIndices().put( key, i ); - } - } - - public Map<String, MavenProject> getProjects() - { - return projects; - } - - public Map<String, Integer> getIndices() - { - return indices; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java deleted file mode 100644 index 5ef77454..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenSession; -import org.apache.maven.execution.ProjectDependencyGraph; -import org.apache.maven.project.MavenProject; - -import java.util.List; - -/** - * A build context that matches a mavenproject to a given tasksegment, and the session to be used. - * <p/> - * A note to the reader; - * <p/> - * There are several issues/discussions regarding how "aggregator" plugins should be handled. - * Read for instance http://docs.codehaus.org/display/MAVEN/Deterministic+Lifecycle+Planning - * <p/> - * In their current implementation they are "bolted" onto the lifecycle by separating them - * into TaskSegments. This class represents the execution context of one such task segment. - * <p/> - * Wise voices have suggested that maybe aggregators shouldn't be bound to the ordinary - * lifecycle at all, in which case we wouldn't be needing this class at all ( and - * ProjectBuildList.getByTaskSegments). Or maybe they should be introduced in the calculation - * of the execution plan instead, which seems much nicer. - * <p/> - * Additionally this class contains a clone of the MavenSession, which is *only* needed - * because it has as notion of a "current" project. - * - * @since 3.0 - * @author Jason van Zyl - * @author Benjamin Bentmann - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public final class ProjectSegment -{ - private final MavenProject project; - - private final TaskSegment taskSegment; - - private final MavenSession session; - - private final List<MavenProject> nonTransitiveUpstreamProjects; - - private final List<MavenProject> transitiveUpstreamProjects; - - public ProjectSegment( MavenProject project, TaskSegment taskSegment, MavenSession copiedSession ) - { - this.project = project; - this.taskSegment = taskSegment; - this.session = copiedSession; - final ProjectDependencyGraph dependencyGraph = getSession().getProjectDependencyGraph(); - nonTransitiveUpstreamProjects = dependencyGraph.getUpstreamProjects( getProject(), false ); - transitiveUpstreamProjects = dependencyGraph.getUpstreamProjects( getProject(), true ); - } - - public MavenSession getSession() - { - return session; - } - - public MavenProject getProject() - { - return project; - } - - public TaskSegment getTaskSegment() - { - return taskSegment; - } - - public List<MavenProject> getImmediateUpstreamProjects() - { - return nonTransitiveUpstreamProjects; - } - - public List<MavenProject> getTransitiveUpstreamProjects() - { - return transitiveUpstreamProjects; - } - - @Override - public String toString() - { - return getProject().getId() + " -> " + getTaskSegment(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java deleted file mode 100644 index 2e2c3fd4..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.ProjectDependencyGraph; -import org.apache.maven.lifecycle.internal.builder.BuilderCommon; -import org.apache.maven.project.MavenProject; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; - -/** - * Contains status information that is global to an entire reactor build. - * - * @since 3.0 - * @author <a href="mailto:kristian.rosenvold@gmail.com">Kristian Rosenvold</a> - */ -public class ReactorBuildStatus -{ - private final ProjectDependencyGraph projectDependencyGraph; - - private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<String>() ); - - private volatile boolean halted = false; - - public ReactorBuildStatus( ProjectDependencyGraph projectDependencyGraph ) - { - this.projectDependencyGraph = projectDependencyGraph; - } - - public boolean isBlackListed( MavenProject project ) - { - return blackListedProjects.contains( BuilderCommon.getKey( project ) ); - } - - public void blackList( MavenProject project ) - { - if ( blackListedProjects.add( BuilderCommon.getKey( project ) ) && projectDependencyGraph != null ) - { - for ( MavenProject downstreamProject : projectDependencyGraph.getDownstreamProjects( project, true ) ) - { - blackListedProjects.add( BuilderCommon.getKey( downstreamProject ) ); - } - } - } - - public void halt() - { - halted = true; - } - - public boolean isHalted() - { - return halted; - } - - public boolean isHaltedOrBlacklisted( MavenProject mavenProject ) - { - return isBlackListed( mavenProject ) || isHalted(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java deleted file mode 100644 index 7df53140..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.MavenExecutionResult; -import org.apache.maven.session.scope.internal.SessionScope; - -/** - * Context that is fixed for the entire reactor build. - * - * @since 3.0 - * @author Jason van Zyl - * @author Kristian Rosenvold - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public class ReactorContext -{ - private final MavenExecutionResult result; - - private final ProjectIndex projectIndex; - - private final ClassLoader originalContextClassLoader; - - private final ReactorBuildStatus reactorBuildStatus; - - private final SessionScope.Memento sessionScope; - - public ReactorContext( MavenExecutionResult result, ProjectIndex projectIndex, - ClassLoader originalContextClassLoader, ReactorBuildStatus reactorBuildStatus, - SessionScope.Memento sessionScope ) - { - this.result = result; - this.projectIndex = projectIndex; - this.originalContextClassLoader = originalContextClassLoader; - this.reactorBuildStatus = reactorBuildStatus; - this.sessionScope = sessionScope; - } - - public ReactorBuildStatus getReactorBuildStatus() - { - return reactorBuildStatus; - } - - public MavenExecutionResult getResult() - { - return result; - } - - public ProjectIndex getProjectIndex() - { - return projectIndex; - } - - public ClassLoader getOriginalContextClassLoader() - { - return originalContextClassLoader; - } - - /** - * @since 3.3.0 - */ - public SessionScope.Memento getSessionScopeMemento() - { - return sessionScope; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java deleted file mode 100644 index 9551887c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.apache.maven.lifecycle.internal; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Describes the required task segment as provided on the maven command line; i.e. "clean jetty:run install" - * - * @since 3.0 - * @author Benjamin Bentmann - * @author Kristian Rosenvold (extracted class only) - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public final class TaskSegment -{ - - // Can be both "LifeCycleTask" (clean/install) and "GoalTask" (org.mortbay.jetty:maven-jetty-plugin:6.1.19:run) - - private final List<Object> tasks; - - private final boolean aggregating; - - public TaskSegment( boolean aggregating ) - { - this.aggregating = aggregating; - tasks = new ArrayList<Object>(); - } - - public TaskSegment( boolean aggregating, Object... tasks ) - { - this.aggregating = aggregating; - this.tasks = new ArrayList<Object>( Arrays.asList( tasks ) ); - } - - @Override - public String toString() - { - return getTasks().toString(); - } - - public List<Object> getTasks() - { - return tasks; - } - - public boolean isAggregating() - { - return aggregating; - } - - // TODO: Consider throwing UnsupprtedSomething on hashCode/equals -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java deleted file mode 100644 index 155abf92..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; -import java.util.concurrent.ExecutionException; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.internal.ProjectBuildList; -import org.apache.maven.lifecycle.internal.ReactorBuildStatus; -import org.apache.maven.lifecycle.internal.ReactorContext; -import org.apache.maven.lifecycle.internal.TaskSegment; - -/** - * A {@link Builder} encapsulates a strategy for building a set of Maven projects. The default strategy in Maven builds - * the the projects serially, but a {@link Builder} can employ any type of concurrency model to build the projects. - * - * @author jvanzyl - * @provisional - */ -public interface Builder -{ - // - // Be nice to whittle this down to Session, maybe add task segments to the session. The session really is the - // the place to store reactor related information. - // - void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, - List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus ) - throws ExecutionException, InterruptedException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java deleted file mode 100644 index 34fb323e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java +++ /dev/null @@ -1,199 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.Artifact; -import org.apache.maven.execution.BuildFailure; -import org.apache.maven.execution.ExecutionEvent; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.LifecycleExecutionException; -import org.apache.maven.lifecycle.LifecycleNotFoundException; -import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.lifecycle.internal.ExecutionEventCatapult; -import org.apache.maven.lifecycle.internal.LifecycleDebugLogger; -import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator; -import org.apache.maven.lifecycle.internal.ReactorContext; -import org.apache.maven.lifecycle.internal.TaskSegment; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.MojoNotFoundException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; - -import java.util.Set; - -/** - * Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder - * - * @since 3.0 - * @author Kristian Rosenvold - * Builds one or more lifecycles for a full module - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = BuilderCommon.class ) -public class BuilderCommon -{ - @Requirement - private LifecycleDebugLogger lifecycleDebugLogger; - - @Requirement - private LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator; - - @Requirement - private ExecutionEventCatapult eventCatapult; - - @Requirement - private Logger logger; - - - public BuilderCommon() - { - } - - public BuilderCommon( LifecycleDebugLogger lifecycleDebugLogger, - LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, Logger logger ) - { - this.lifecycleDebugLogger = lifecycleDebugLogger; - this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator; - this.logger = logger; - } - - public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment, - Set<Artifact> projectArtifacts ) - throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException, - PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, - NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException, - LifecycleExecutionException - { - MavenExecutionPlan executionPlan = - lifeCycleExecutionPlanCalculator.calculateExecutionPlan( session, project, taskSegment.getTasks() ); - - lifecycleDebugLogger.debugProjectPlan( project, executionPlan ); - - if ( session.getRequest().getDegreeOfConcurrency() > 1 ) - { - final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins(); - if ( !unsafePlugins.isEmpty() && logger.isDebugEnabled() ) - { - logger.warn( "*****************************************************************" ); - logger.warn( "* Your build is requesting parallel execution, but project *" ); - logger.warn( "* contains the following plugin(s) that have goals not marked *" ); - logger.warn( "* as @threadSafe to support parallel building. *" ); - logger.warn( "* While this /may/ work fine, please look for plugin updates *" ); - logger.warn( "* and/or request plugins be made thread-safe. *" ); - logger.warn( "* If reporting an issue, report it against the plugin in *" ); - logger.warn( "* question, not against maven-core *" ); - logger.warn( "*****************************************************************" ); - if ( logger.isDebugEnabled() ) - { - final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos(); - logger.warn( "The following goals are not marked @threadSafe in " + project.getName() + ":" ); - for ( MojoDescriptor unsafeGoal : unsafeGoals ) - { - logger.warn( unsafeGoal.getId() ); - } - } - else - { - logger.warn( "The following plugins are not marked @threadSafe in " + project.getName() + ":" ); - for ( Plugin unsafePlugin : unsafePlugins ) - { - logger.warn( unsafePlugin.getId() ); - } - logger.warn( "Enable debug to see more precisely which goals are not marked @threadSafe." ); - } - logger.warn( "*****************************************************************" ); - } - } - - return executionPlan; - } - - public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession, - final MavenSession currentSession, final MavenProject mavenProject, Throwable t, - final long buildStartTime ) - { - // record the error and mark the project as failed - long buildEndTime = System.currentTimeMillis(); - buildContext.getResult().addException( t ); - buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, t ) ); - - // notify listeners about "soft" project build failures only - if ( t instanceof Exception && !( t instanceof RuntimeException ) ) - { - eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, currentSession, null, (Exception) t ); - } - - // reactor failure modes - if ( t instanceof RuntimeException || !( t instanceof Exception ) ) - { - // fail fast on RuntimeExceptions, Errors and "other" Throwables - // assume these are system errors and further build is meaningless - buildContext.getReactorBuildStatus().halt(); - } - else if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) ) - { - // continue the build - } - else if ( MavenExecutionRequest.REACTOR_FAIL_AT_END.equals( rootSession.getReactorFailureBehavior() ) ) - { - // continue the build but ban all projects that depend on the failed one - buildContext.getReactorBuildStatus().blackList( mavenProject ); - } - else if ( MavenExecutionRequest.REACTOR_FAIL_FAST.equals( rootSession.getReactorFailureBehavior() ) ) - { - buildContext.getReactorBuildStatus().halt(); - } - else - { - logger.error( "invalid reactor failure behavior " + rootSession.getReactorFailureBehavior() ); - buildContext.getReactorBuildStatus().halt(); - } - } - - public static void attachToThread( MavenProject currentProject ) - { - ClassRealm projectRealm = currentProject.getClassRealm(); - if ( projectRealm != null ) - { - Thread.currentThread().setContextClassLoader( projectRealm ); - } - } - - // Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some - // reason it isn't ? This localization is kind-of a code smell. - - public static String getKey( MavenProject project ) - { - return project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java deleted file mode 100644 index 52c668f1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -public class BuilderNotFoundException - extends Exception -{ - public BuilderNotFoundException( String message ) - { - super( message ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java deleted file mode 100644 index de6a5a31..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder.multithreaded; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.execution.ProjectDependencyGraph; -import org.apache.maven.lifecycle.internal.ProjectBuildList; -import org.apache.maven.lifecycle.internal.ProjectSegment; -import org.apache.maven.project.MavenProject; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Presents a view of the Dependency Graph that is suited for concurrent building. - * - * @since 3.0 - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -public class ConcurrencyDependencyGraph -{ - - private final ProjectBuildList projectBuilds; - - private final ProjectDependencyGraph projectDependencyGraph; - - private final HashSet<MavenProject> finishedProjects = new HashSet<MavenProject>(); - - public ConcurrencyDependencyGraph( ProjectBuildList projectBuilds, ProjectDependencyGraph projectDependencyGraph ) - { - this.projectDependencyGraph = projectDependencyGraph; - this.projectBuilds = projectBuilds; - } - - public int getNumberOfBuilds() - { - return projectBuilds.size(); - } - - /** - * Gets all the builds that have no reactor-dependencies - * - * @return A list of all the initial builds - */ - - public List<MavenProject> getRootSchedulableBuilds() - { - List<MavenProject> result = new ArrayList<MavenProject>(); - for ( ProjectSegment projectBuild : projectBuilds ) - { - if ( projectDependencyGraph.getUpstreamProjects( projectBuild.getProject(), false ).size() == 0 ) - { - result.add( projectBuild.getProject() ); - } - } - return result; - } - - /** - * Marks the provided project as finished. Returns a list of - * - * @param mavenProject The project - * @return The list of builds that are eligible for starting now that the provided project is done - */ - public List<MavenProject> markAsFinished( MavenProject mavenProject ) - { - finishedProjects.add( mavenProject ); - return getSchedulableNewProcesses( mavenProject ); - } - - private List<MavenProject> getSchedulableNewProcesses( MavenProject finishedProject ) - { - List<MavenProject> result = new ArrayList<MavenProject>(); - // schedule dependent projects, if all of their requirements are met - for ( MavenProject dependentProject : projectDependencyGraph.getDownstreamProjects( finishedProject, false ) ) - { - final List<MavenProject> upstreamProjects = - projectDependencyGraph.getUpstreamProjects( dependentProject, false ); - if ( finishedProjects.containsAll( upstreamProjects ) ) - { - result.add( dependentProject ); - } - } - return result; - } - - /** - * @return set of projects that have yet to be processed successfully by the build. - */ - public Set<MavenProject> getUnfinishedProjects() - { - Set<MavenProject> unfinished = new HashSet<MavenProject>( projectBuilds.getProjects() ); - unfinished.remove( finishedProjects ); - return unfinished; - } - - /** - * @return set of projects that have been successfully processed by the build. - */ - protected Set<MavenProject> getFinishedProjects() - { - return finishedProjects; - } - - protected ProjectBuildList getProjectBuilds() - { - return projectBuilds; - } - - /** - * For the given {@link MavenProject} {@code p}, return all of {@code p}'s dependencies. - * - * @param p - * @return List of prerequisite projects - */ - protected List<MavenProject> getDependencies( MavenProject p ) - { - return projectDependencyGraph.getUpstreamProjects( p, false ); - } - - /** - * For the given {@link MavenProject} {@code p} return {@code p}'s uncompleted dependencies. - * - * @param p - * @return List of uncompleted prerequisite projects - */ - public List<MavenProject> getActiveDependencies( MavenProject p ) - { - List<MavenProject> activeDependencies = projectDependencyGraph.getUpstreamProjects( p, false ); - activeDependencies.removeAll( finishedProjects ); - return activeDependencies; - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java deleted file mode 100644 index 906e5e75..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java +++ /dev/null @@ -1,197 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder.multithreaded; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletionService; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorCompletionService; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.internal.BuildThreadFactory; -import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder; -import org.apache.maven.lifecycle.internal.ProjectBuildList; -import org.apache.maven.lifecycle.internal.ProjectSegment; -import org.apache.maven.lifecycle.internal.ReactorBuildStatus; -import org.apache.maven.lifecycle.internal.ReactorContext; -import org.apache.maven.lifecycle.internal.TaskSegment; -import org.apache.maven.lifecycle.internal.builder.Builder; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; - -/** - * Builds the full lifecycle in weave-mode (phase by phase as opposed to project-by-project) - * - * @since 3.0 - * @author Kristian Rosenvold - * Builds one or more lifecycles for a full module - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - */ -@Component( role = Builder.class, hint = "multithreaded" ) -public class MultiThreadedBuilder - implements Builder -{ - - @Requirement - private Logger logger; - - @Requirement - private LifecycleModuleBuilder lifecycleModuleBuilder; - - - public MultiThreadedBuilder() - { - } - - @Override - public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, - List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus ) - throws ExecutionException, InterruptedException - { - ExecutorService executor = - Executors.newFixedThreadPool( Math.min( session.getRequest().getDegreeOfConcurrency(), - session.getProjects().size() ), new BuildThreadFactory() ); - CompletionService<ProjectSegment> service = new ExecutorCompletionService<ProjectSegment>( executor ); - ConcurrencyDependencyGraph analyzer = - new ConcurrencyDependencyGraph( projectBuilds, session.getProjectDependencyGraph() ); - - // Currently disabled - ThreadOutputMuxer muxer = null; // new ThreadOutputMuxer( analyzer.getProjectBuilds(), System.out ); - - for ( TaskSegment taskSegment : taskSegments ) - { - Map<MavenProject, ProjectSegment> projectBuildMap = projectBuilds.selectSegment( taskSegment ); - try - { - multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment, - projectBuildMap, muxer ); - if ( reactorContext.getReactorBuildStatus().isHalted() ) - { - break; - } - } - catch ( Exception e ) - { - session.getResult().addException( e ); - break; - } - - } - } - - private void multiThreadedProjectTaskSegmentBuild( ConcurrencyDependencyGraph analyzer, - ReactorContext reactorContext, MavenSession rootSession, - CompletionService<ProjectSegment> service, - TaskSegment taskSegment, - Map<MavenProject, ProjectSegment> projectBuildList, - ThreadOutputMuxer muxer ) - { - - // schedule independent projects - for ( MavenProject mavenProject : analyzer.getRootSchedulableBuilds() ) - { - ProjectSegment projectSegment = projectBuildList.get( mavenProject ); - logger.debug( "Scheduling: " + projectSegment.getProject() ); - Callable<ProjectSegment> cb = - createBuildCallable( rootSession, projectSegment, reactorContext, taskSegment, muxer ); - service.submit( cb ); - } - - // for each finished project - for ( int i = 0; i < analyzer.getNumberOfBuilds(); i++ ) - { - try - { - ProjectSegment projectBuild = service.take().get(); - if ( reactorContext.getReactorBuildStatus().isHalted() ) - { - break; - } - final List<MavenProject> newItemsThatCanBeBuilt = - analyzer.markAsFinished( projectBuild.getProject() ); - for ( MavenProject mavenProject : newItemsThatCanBeBuilt ) - { - ProjectSegment scheduledDependent = projectBuildList.get( mavenProject ); - logger.debug( "Scheduling: " + scheduledDependent ); - Callable<ProjectSegment> cb = - createBuildCallable( rootSession, scheduledDependent, reactorContext, taskSegment, muxer ); - service.submit( cb ); - } - } - catch ( InterruptedException e ) - { - rootSession.getResult().addException( e ); - break; - } - catch ( ExecutionException e ) - { - // TODO MNG-5766 changes likely made this redundant - rootSession.getResult().addException( e ); - break; - } - } - - // cancel outstanding builds (if any) - this can happen if an exception is thrown in above block - - Future<ProjectSegment> unprocessed; - while ( ( unprocessed = service.poll() ) != null ) - { - try - { - unprocessed.get(); - } - catch ( InterruptedException e ) - { - throw new RuntimeException( e ); - } - catch ( ExecutionException e ) - { - throw new RuntimeException( e ); - } - } - } - - private Callable<ProjectSegment> createBuildCallable( final MavenSession rootSession, - final ProjectSegment projectBuild, - final ReactorContext reactorContext, - final TaskSegment taskSegment, final ThreadOutputMuxer muxer ) - { - return new Callable<ProjectSegment>() - { - public ProjectSegment call() - { - // muxer.associateThreadWithProjectSegment( projectBuild ); - lifecycleModuleBuilder.buildProject( projectBuild.getSession(), rootSession, reactorContext, - projectBuild.getProject(), taskSegment ); - // muxer.setThisModuleComplete( projectBuild ); - - return projectBuild; - } - }; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java deleted file mode 100644 index 8f1f4932..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java +++ /dev/null @@ -1,477 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder.multithreaded; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.lifecycle.internal.ProjectBuildList; -import org.apache.maven.lifecycle.internal.ProjectSegment; - -/** - * @since 3.0 - * @author Kristian Rosenvold - * <p/> - * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. - * This class in particular may spontaneusly self-combust and be replaced by a plexus-compliant thread aware - * logger implementation at any time. - */ -@SuppressWarnings( { "SynchronizationOnLocalVariableOrMethodParameter" } ) -public class ThreadOutputMuxer -{ - private final Iterator<ProjectSegment> projects; - - private final ThreadLocal<ProjectSegment> projectBuildThreadLocal = new ThreadLocal<ProjectSegment>(); - - private final Map<ProjectSegment, ByteArrayOutputStream> streams = - new HashMap<ProjectSegment, ByteArrayOutputStream>(); - - private final Map<ProjectSegment, PrintStream> printStreams = new HashMap<ProjectSegment, PrintStream>(); - - private final ByteArrayOutputStream defaultOutputStreamForUnknownData = new ByteArrayOutputStream(); - - private final PrintStream defaultPringStream = new PrintStream( defaultOutputStreamForUnknownData ); - - private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<ProjectSegment>() ); - - private volatile ProjectSegment currentBuild; - - private final PrintStream originalSystemOUtStream; - - private final ConsolePrinter printer; - - /** - * A simple but safe solution for printing to the console. - */ - - class ConsolePrinter - implements Runnable - { - public volatile boolean running; - - private final ProjectBuildList projectBuildList; - - ConsolePrinter( ProjectBuildList projectBuildList ) - { - this.projectBuildList = projectBuildList; - } - - public void run() - { - running = true; - for ( ProjectSegment projectBuild : projectBuildList ) - { - final PrintStream projectStream = printStreams.get( projectBuild ); - ByteArrayOutputStream projectOs = streams.get( projectBuild ); - - do - { - synchronized ( projectStream ) - { - try - { - projectStream.wait( 100 ); - } - catch ( InterruptedException e ) - { - throw new RuntimeException( e ); - } - try - { - projectOs.writeTo( originalSystemOUtStream ); - } - catch ( IOException e ) - { - throw new RuntimeException( e ); - } - - projectOs.reset(); - } - } - while ( !completedBuilds.contains( projectBuild ) ); - } - running = false; - } - - /* - Wait until we are sure the print-stream thread is running. - */ - - public void waitUntilRunning( boolean expect ) - { - while ( !running == expect ) - { - try - { - Thread.sleep( 10 ); - } - catch ( InterruptedException e ) - { - throw new RuntimeException( e ); - } - } - } - } - - public ThreadOutputMuxer( ProjectBuildList segmentChunks, PrintStream originalSystemOut ) - { - projects = segmentChunks.iterator(); - for ( ProjectSegment segmentChunk : segmentChunks ) - { - final ByteArrayOutputStream value = new ByteArrayOutputStream(); - streams.put( segmentChunk, value ); - printStreams.put( segmentChunk, new PrintStream( value ) ); - } - setNext(); - this.originalSystemOUtStream = originalSystemOut; - System.setOut( new ThreadBoundPrintStream( this.originalSystemOUtStream ) ); - printer = new ConsolePrinter( segmentChunks ); - new Thread( printer ).start(); - printer.waitUntilRunning( true ); - } - - public void close() - { - printer.waitUntilRunning( false ); - System.setOut( this.originalSystemOUtStream ); - } - - private void setNext() - { - currentBuild = projects.hasNext() ? projects.next() : null; - } - - private boolean ownsRealOutputStream( ProjectSegment projectBuild ) - { - return projectBuild.equals( currentBuild ); - } - - private PrintStream getThreadBoundPrintStream() - { - ProjectSegment threadProject = projectBuildThreadLocal.get(); - if ( threadProject == null ) - { - return defaultPringStream; - } - if ( ownsRealOutputStream( threadProject ) ) - { - return originalSystemOUtStream; - } - return printStreams.get( threadProject ); - } - - public void associateThreadWithProjectSegment( ProjectSegment projectBuild ) - { - projectBuildThreadLocal.set( projectBuild ); - } - - public void setThisModuleComplete( ProjectSegment projectBuild ) - { - completedBuilds.add( projectBuild ); - PrintStream stream = printStreams.get( projectBuild ); - synchronized ( stream ) - { - stream.notifyAll(); - } - disconnectThreadFromProject(); - } - - private void disconnectThreadFromProject() - { - projectBuildThreadLocal.remove(); - } - - private class ThreadBoundPrintStream - extends PrintStream - { - - public ThreadBoundPrintStream( PrintStream systemOutStream ) - { - super( systemOutStream ); - } - - private PrintStream getOutputStreamForCurrentThread() - { - return getThreadBoundPrintStream(); - } - - @Override - public void println() - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println(); - currentStream.notifyAll(); - } - } - - @Override - public void print( char c ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( c ); - currentStream.notifyAll(); - } - } - - @Override - public void println( char x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( double d ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( d ); - currentStream.notifyAll(); - } - } - - @Override - public void println( double x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( float f ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( f ); - currentStream.notifyAll(); - } - } - - @Override - public void println( float x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( int i ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( i ); - currentStream.notifyAll(); - } - } - - @Override - public void println( int x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( long l ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( l ); - currentStream.notifyAll(); - } - } - - @Override - public void println( long x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( boolean b ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( b ); - currentStream.notifyAll(); - } - } - - @Override - public void println( boolean x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( char s[] ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( s ); - currentStream.notifyAll(); - } - } - - @Override - public void println( char x[] ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( Object obj ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( obj ); - currentStream.notifyAll(); - } - } - - @Override - public void println( Object x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void print( String s ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.print( s ); - currentStream.notifyAll(); - } - } - - @Override - public void println( String x ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.println( x ); - currentStream.notifyAll(); - } - } - - @Override - public void write( byte b[], int off, int len ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.write( b, off, len ); - currentStream.notifyAll(); - } - } - - @Override - public void close() - { - getOutputStreamForCurrentThread().close(); - } - - @Override - public void flush() - { - getOutputStreamForCurrentThread().flush(); - } - - @Override - public void write( int b ) - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.write( b ); - currentStream.notifyAll(); - } - } - - @Override - public void write( byte b[] ) - throws IOException - { - final PrintStream currentStream = getOutputStreamForCurrentThread(); - synchronized ( currentStream ) - { - currentStream.write( b ); - currentStream.notifyAll(); - } - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java deleted file mode 100644 index 464944f1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.maven.lifecycle.internal.builder.singlethreaded; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 java.util.List; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder; -import org.apache.maven.lifecycle.internal.ProjectBuildList; -import org.apache.maven.lifecycle.internal.ProjectSegment; -import org.apache.maven.lifecycle.internal.ReactorBuildStatus; -import org.apache.maven.lifecycle.internal.ReactorContext; -import org.apache.maven.lifecycle.internal.TaskSegment; -import org.apache.maven.lifecycle.internal.builder.Builder; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -@Component( role = Builder.class, hint = "singlethreaded" ) -public class SingleThreadedBuilder - implements Builder -{ - @Requirement - private LifecycleModuleBuilder lifecycleModuleBuilder; - - public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, - List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus ) - { - for ( TaskSegment taskSegment : taskSegments ) - { - for ( ProjectSegment projectBuild : projectBuilds.getByTaskSegment( taskSegment ) ) - { - try - { - lifecycleModuleBuilder.buildProject( session, reactorContext, projectBuild.getProject(), - taskSegment ); - if ( reactorBuildStatus.isHalted() ) - { - break; - } - } - catch ( Exception e ) - { - break; // Why are we just ignoring this exception? Are exceptions are being used for flow control - } - } - } - } -} |