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   */
45  public class MavenReportExecution
46  {
47      private MavenReport mavenReport;
48  
49      private ClassLoader classLoader;
50  
51      private Plugin plugin;
52  
53      public MavenReportExecution( Plugin plugin, MavenReport mavenReport, ClassLoader classLoader )
54      {
55          this.setPlugin( plugin );
56          this.mavenReport = mavenReport;
57          this.classLoader = classLoader;
58      }
59  
60      public MavenReportExecution( MavenReport mavenReport )
61      {
62          this( null, mavenReport, null );
63      }
64  
65      public MavenReport getMavenReport()
66      {
67          return mavenReport;
68      }
69  
70      public void setMavenReport( MavenReport mavenReport )
71      {
72          this.mavenReport = mavenReport;
73      }
74  
75      public ClassLoader getClassLoader()
76      {
77          return classLoader;
78      }
79  
80      public void setClassLoader( ClassLoader classLoader )
81      {
82          this.classLoader = classLoader;
83      }
84  
85      public void setPlugin( Plugin plugin )
86      {
87          this.plugin = plugin;
88      }
89  
90      public Plugin getPlugin()
91      {
92          return plugin;
93      }
94  }