org.apache.maven.plugin.changes.ProjectUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-changes-plugin Show documentation
Show all versions of maven-changes-plugin Show documentation
Creates a release history for inclusion into the site and assists in generating an announcement mail.
package org.apache.maven.plugin.changes;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
/**
* A utility class for working with Project objects.
*
* @author Dennis Lundberg
* @version $Id: ProjectUtils.java 1054098 2010-12-31 11:54:28Z dennisl $
* @since 2.4
*/
public class ProjectUtils
{
/**
* Check if the issue management system has been properly configured in the Maven project.
*
* @param project The Maven project
* @param issueManagementSystem The name of the issue management system that is required
* @param mojoResult What the calling mojo produces, used in the error messages
* @param log A log
* @return true
if the <issueManagement> element of the POM is complete,
* otherwise false
*/
public static boolean validateIfIssueManagementComplete( MavenProject project, String issueManagementSystem,
String mojoResult, Log log )
{
if ( project.getIssueManagement() == null )
{
log.error( "No Issue Management set. No " + mojoResult + " will be generated." );
return false;
}
else if ( ( project.getIssueManagement().getUrl() == null )
|| ( project.getIssueManagement().getUrl().trim().equals( "" ) ) )
{
log.error( "No URL set in Issue Management. No " + mojoResult + " will be generated." );
return false;
}
else if ( ( project.getIssueManagement().getSystem() != null )
&& !( project.getIssueManagement().getSystem().equalsIgnoreCase( issueManagementSystem ) ) )
{
log.error( "The " + mojoResult + " only supports " + issueManagementSystem + ". No " + mojoResult
+ " will be generated." );
return false;
}
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy