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  
 
 25  
 /**
 26  
  * Abstract superclass for announcement mojos.
 27  
  *
 28  
  * @version $Id: AbstractAnnouncementMojo.java 1050209 2010-12-16 22:53:04Z dennisl $
 29  
  * @since 2.3
 30  
  */
 31  1
 public abstract class AbstractAnnouncementMojo
 32  
     extends AbstractMojo
 33  
 {
 34  
     /**
 35  
      * The current project base directory.
 36  
      *
 37  
      * @parameter expression="${basedir}"
 38  
      * @required
 39  
      * @since 2.1
 40  
      */
 41  
     protected String basedir;
 42  
 
 43  
     /**
 44  
      * The Maven Session.
 45  
      *
 46  
      * @parameter expression="${session}"
 47  
      * @readonly
 48  
      * @required
 49  
      * @since 2.3
 50  
      */
 51  
     protected MavenSession mavenSession;
 52  
 
 53  
     /**
 54  
      * This will cause the execution to be run only at the top of a given module
 55  
      * tree. That is, run in the project contained in the same folder where the
 56  
      * mvn execution was launched.
 57  
      *
 58  
      * @parameter expression="${announcement.runOnlyAtExecutionRoot}" default-value="false"
 59  
      * @since 2.3
 60  
      */
 61  
     protected boolean runOnlyAtExecutionRoot;
 62  
 
 63  
     /**
 64  
      * Returns <code>true</code> if the current project is located at the
 65  
      * Execution Root Directory (where mvn was launched).
 66  
      *
 67  
      * @return <code>true</code> if the current project is at the Execution Root
 68  
      */
 69  
     protected boolean isThisTheExecutionRoot()
 70  
     {
 71  0
         getLog().debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() );
 72  0
         getLog().debug( "Current Folder:" + basedir );
 73  0
         boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
 74  0
         if ( result )
 75  
         {
 76  0
             getLog().debug( "This is the execution root." );
 77  
         }
 78  
         else
 79  
         {
 80  0
             getLog().debug( "This is NOT the execution root." );
 81  
         }
 82  0
         return result;
 83  
     }
 84  
 }