View Javadoc

1   package org.apache.maven.reporting.exec;
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 org.apache.maven.model.Plugin;
23  import org.apache.maven.reporting.MavenReport;
24  
25  /**
26   * <p>
27   *   Since maven 3 reporting plugin {@link MavenReport} are not anymore injected by maven core
28   *   This class will store all necessary information for {@link MavenReport} execution :
29   *   <ul>
30   *     <li>a build {@link MavenReport}</li>
31   *     <li>The associated {@link ClassLoader} for the Report Mojo execution</li>
32   *     <li>The {@link Plugin} associated to the {@link MavenReport}</li>
33   *   </ul> 
34   * </p>
35   * <p>
36   *   With this it's possible to execute the {@link MavenReport} generate with settings
37   *   the current {@link Thread} classLoader first with {@link #classLoader}
38   * </p>
39   * <p>
40   *   This beans will be build by {@link MavenReportExecutor}.
41   * </p>
42   * 
43   * @author Olivier Lamy
44   * @since 3.0-beta-1
45   */
46  public class MavenReportExecution
47  {
48      private MavenReport mavenReport;
49  
50      private ClassLoader classLoader;
51  
52      private Plugin plugin;
53  
54      public MavenReportExecution( Plugin plugin, MavenReport mavenReport, ClassLoader classLoader )
55      {
56          this.setPlugin( plugin );
57          this.mavenReport = mavenReport;
58          this.classLoader = classLoader;
59      }
60  
61      public MavenReportExecution( MavenReport mavenReport )
62      {
63          this( null, mavenReport, null );
64      }
65  
66      public MavenReport getMavenReport()
67      {
68          return mavenReport;
69      }
70  
71      public void setMavenReport( MavenReport mavenReport )
72      {
73          this.mavenReport = mavenReport;
74      }
75  
76      public ClassLoader getClassLoader()
77      {
78          return classLoader;
79      }
80  
81      public void setClassLoader( ClassLoader classLoader )
82      {
83          this.classLoader = classLoader;
84      }
85  
86      public void setPlugin( Plugin plugin )
87      {
88          this.plugin = plugin;
89      }
90  
91      public Plugin getPlugin()
92      {
93          return plugin;
94      }
95  }