Coverage Report - org.apache.maven.plugin.announcement.AbstractAnnouncementMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractAnnouncementMojo
12%
1/8
0%
0/2
2
 
 1  
 package org.apache.maven.plugin.announcement;
 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.plugin.AbstractMojo;
 23  
 import org.apache.maven.execution.MavenSession;
 24  
 import org.apache.maven.plugins.annotations.Component;
 25  
 import org.apache.maven.plugins.annotations.Parameter;
 26  
 
 27  
 /**
 28  
  * Abstract superclass for announcement mojos.
 29  
  *
 30  
  * @version $Id: AbstractAnnouncementMojo.java 1355880 2012-07-01 13:13:15Z olamy $
 31  
  * @since 2.3
 32  
  */
 33  1
 public abstract class AbstractAnnouncementMojo
 34  
     extends AbstractMojo
 35  
 {
 36  
     /**
 37  
      * The current project base directory.
 38  
      *
 39  
      * @since 2.1
 40  
      */
 41  
     @Parameter( property = "basedir", required = true )
 42  
     protected String basedir;
 43  
 
 44  
     /**
 45  
      * The Maven Session.
 46  
      *
 47  
      * @since 2.3
 48  
      */
 49  
     @Component
 50  
     protected MavenSession mavenSession;
 51  
 
 52  
     /**
 53  
      * This will cause the execution to be run only at the top of a given module
 54  
      * tree. That is, run in the project contained in the same folder where the
 55  
      * mvn execution was launched.
 56  
      *
 57  
      * @since 2.3
 58  
      */
 59  
     @Parameter( property = "announcement.runOnlyAtExecutionRoot", defaultValue = "false" )
 60  
     protected boolean runOnlyAtExecutionRoot;
 61  
 
 62  
     /**
 63  
      * Returns <code>true</code> if the current project is located at the
 64  
      * Execution Root Directory (where mvn was launched).
 65  
      *
 66  
      * @return <code>true</code> if the current project is at the Execution Root
 67  
      */
 68  
     protected boolean isThisTheExecutionRoot()
 69  
     {
 70  0
         getLog().debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() );
 71  0
         getLog().debug( "Current Folder:" + basedir );
 72  0
         boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
 73  0
         if ( result )
 74  
         {
 75  0
             getLog().debug( "This is the execution root." );
 76  
         }
 77  
         else
 78  
         {
 79  0
             getLog().debug( "This is NOT the execution root." );
 80  
         }
 81  0
         return result;
 82  
     }
 83  
 }