Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ForkGoalAggregatorMojo |
|
| 6.0;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-goal-aggregator | |
31 | * @aggregator true | |
32 | * | |
33 | * @execute goal="touch" | |
34 | */ | |
35 | 0 | public class ForkGoalAggregatorMojo |
36 | extends AbstractMojo | |
37 | { | |
38 | /** | |
39 | * @parameter expression="${project}" | |
40 | */ | |
41 | private MavenProject project; | |
42 | ||
43 | /** | |
44 | * @parameter expression="${reactorProjects}" | |
45 | */ | |
46 | private List reactorProjects; | |
47 | ||
48 | public void execute() | |
49 | throws MojoExecutionException | |
50 | { | |
51 | 0 | for ( Iterator it = reactorProjects.iterator(); it.hasNext(); ) |
52 | { | |
53 | 0 | MavenProject executedProject = ( (MavenProject) it.next() ).getExecutionProject(); |
54 | ||
55 | 0 | if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) |
56 | { | |
57 | 0 | throw new MojoExecutionException( "Unexpected result, final name of executed project " |
58 | + executedProject + " is " + executedProject.getBuild().getFinalName() + " (should be \'" | |
59 | + TouchMojo.FINAL_NAME + "\')." ); | |
60 | } | |
61 | 0 | } |
62 | ||
63 | 0 | if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) ) |
64 | { | |
65 | 0 | throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME |
66 | + "\')." ); | |
67 | } | |
68 | 0 | } |
69 | } |