View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.changes;
20  
21  import org.apache.maven.execution.MavenSession;
22  import org.apache.maven.plugins.annotations.Parameter;
23  import org.apache.maven.reporting.AbstractMavenReport;
24  
25  /**
26   * Base class with the things that should be in AbstractMavenReport anyway. Note: This file was copied from r415312 of
27   * AbstractProjectInfoReport in maven-project-info-reports, as a work-around to MCHANGES-88.
28   *
29   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
30   */
31  public abstract class AbstractChangesReport extends AbstractMavenReport {
32      /**
33       * The current project base directory.
34       *
35       * @since 2.10
36       */
37      @Parameter(property = "basedir", required = true)
38      protected String basedir;
39  
40      /**
41       * This will cause the execution to be run only at the top of a given module tree. That is, run in the project
42       * contained in the same folder where the mvn execution was launched.
43       *
44       * @since 2.10
45       */
46      @Parameter(property = "changes.runOnlyAtExecutionRoot", defaultValue = "false")
47      protected boolean runOnlyAtExecutionRoot;
48  
49      /**
50       * The Maven Session.
51       *
52       * @since 2.10
53       */
54      @Parameter(defaultValue = "${session}", readonly = true, required = true)
55      protected MavenSession mavenSession;
56  
57      /**
58       * Returns <code>true</code> if the current project is located at the Execution Root Directory (where mvn was
59       * launched).
60       *
61       * @return <code>true</code> if the current project is at the Execution Root
62       */
63      protected boolean isThisTheExecutionRoot() {
64          return getProject().isExecutionRoot();
65      }
66  }