Coverage Report - org.apache.maven.plugin.changes.ProjectUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
ProjectUtils
0%
0/11
0%
0/10
9
 
 1  
 package org.apache.maven.plugin.changes;
 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.logging.Log;
 23  
 import org.apache.maven.project.MavenProject;
 24  
 
 25  
 /**
 26  
  * A utility class for working with Project objects.
 27  
  *
 28  
  * @author Dennis Lundberg
 29  
  * @version $Id: ProjectUtils.java 1054098 2010-12-31 11:54:28Z dennisl $
 30  
  * @since 2.4
 31  
  */
 32  0
 public class ProjectUtils
 33  
 {
 34  
     /**
 35  
      * Check if the issue management system has been properly configured in the Maven project.
 36  
      *
 37  
      * @param project The Maven project
 38  
      * @param issueManagementSystem The name of the issue management system that is required
 39  
      * @param mojoResult What the calling mojo produces, used in the error messages
 40  
      * @param log A log
 41  
      * @return <code>true</code> if the &lt;issueManagement&gt; element of the POM is complete,
 42  
      * otherwise <code>false</code>
 43  
      */
 44  
     public static boolean validateIfIssueManagementComplete( MavenProject project, String issueManagementSystem,
 45  
                                                              String mojoResult, Log log )
 46  
     {
 47  0
         if ( project.getIssueManagement() == null )
 48  
         {
 49  0
             log.error( "No Issue Management set. No " + mojoResult + " will be generated." );
 50  
 
 51  0
             return false;
 52  
         }
 53  0
         else if ( ( project.getIssueManagement().getUrl() == null )
 54  
             || ( project.getIssueManagement().getUrl().trim().equals( "" ) ) )
 55  
         {
 56  0
             log.error( "No URL set in Issue Management. No " + mojoResult + " will be generated." );
 57  
 
 58  0
             return false;
 59  
         }
 60  0
         else if ( ( project.getIssueManagement().getSystem() != null )
 61  
             && !( project.getIssueManagement().getSystem().equalsIgnoreCase( issueManagementSystem ) ) )
 62  
         {
 63  0
             log.error( "The " + mojoResult + " only supports " + issueManagementSystem + ".  No " + mojoResult
 64  
                 + " will be generated." );
 65  
 
 66  0
             return false;
 67  
         }
 68  0
         return true;
 69  
     }
 70  
 }