Coverage Report - org.apache.maven.plugin.coreit.ForkLifecycleAggregatorMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
ForkLifecycleAggregatorMojo
0 %
0/9
0 %
0/6
6
 
 1  
 package org.apache.maven.plugin.coreit;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.Iterator;
 23  
 import java.util.List;
 24  
 
 25  
 import org.apache.maven.plugin.AbstractMojo;
 26  
 import org.apache.maven.plugin.MojoExecutionException;
 27  
 import org.apache.maven.project.MavenProject;
 28  
 
 29  
 /**
 30  
  * @goal fork-lifecycle-aggregator
 31  
  * @aggregator true
 32  
  *
 33  
  * @execute phase="generate-sources" lifecycle="foo"
 34  
  */
 35  0
 public class ForkLifecycleAggregatorMojo
 36  
     extends AbstractMojo
 37  
 {
 38  
 
 39  
     /**
 40  
      * @parameter expression="${project}"
 41  
      */
 42  
     private MavenProject project;
 43  
 
 44  
     /**
 45  
      * @parameter expression="${reactorProjects}"
 46  
      */
 47  
     private List reactorProjects;
 48  
 
 49  
     public void execute()
 50  
         throws MojoExecutionException
 51  
     {
 52  0
         for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
 53  
         {
 54  0
             MavenProject executedProject = ( (MavenProject) it.next() ).getExecutionProject();
 55  
 
 56  0
             if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
 57  
             {
 58  0
                 throw new MojoExecutionException( "Unexpected result, final name of executed project "
 59  
                     + executedProject + " is " + executedProject.getBuild().getFinalName() + " (should be \'"
 60  
                     + TouchMojo.FINAL_NAME + "\')." );
 61  
             }
 62  0
         }
 63  
 
 64  0
         if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
 65  
         {
 66  0
             throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME
 67  
                 + "\')." );
 68  
         }
 69  0
     }
 70  
 
 71  
 }