001package org.apache.maven.lifecycle.internal.builder.singlethreaded; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.List; 023 024import org.apache.maven.execution.MavenSession; 025import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder; 026import org.apache.maven.lifecycle.internal.ProjectBuildList; 027import org.apache.maven.lifecycle.internal.ProjectSegment; 028import org.apache.maven.lifecycle.internal.ReactorBuildStatus; 029import org.apache.maven.lifecycle.internal.ReactorContext; 030import org.apache.maven.lifecycle.internal.TaskSegment; 031import org.apache.maven.lifecycle.internal.builder.Builder; 032import org.codehaus.plexus.component.annotations.Component; 033import org.codehaus.plexus.component.annotations.Requirement; 034 035@Component( role = Builder.class, hint = "singlethreaded" ) 036public class SingleThreadedBuilder 037 implements Builder 038{ 039 @Requirement 040 private LifecycleModuleBuilder lifecycleModuleBuilder; 041 042 public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, 043 List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus ) 044 { 045 for ( TaskSegment taskSegment : taskSegments ) 046 { 047 for ( ProjectSegment projectBuild : projectBuilds.getByTaskSegment( taskSegment ) ) 048 { 049 try 050 { 051 lifecycleModuleBuilder.buildProject( session, reactorContext, projectBuild.getProject(), 052 taskSegment ); 053 if ( reactorBuildStatus.isHalted() ) 054 { 055 break; 056 } 057 } 058 catch ( Exception e ) 059 { 060 break; // Why are we just ignoring this exception? Are exceptions are being used for flow control 061 } 062 } 063 } 064 } 065}