Search in sources :

Example 1 with GrailsPluginProject

use of org.grails.maven.plugin.tools.GrailsPluginProject in project grails-maven by grails.

the class MvnPluginValidateMojo method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    try {
        getGrailsServices().readProjectDescriptor();
    } catch (final MojoExecutionException e) {
        getLog().info("No Grails project found - skipping validation.");
        return;
    }
    final GrailsPluginProject grailsProject = getGrailsServices().readGrailsPluginProject();
    final String pluginName = grailsProject.getPluginName();
    if (!artifactId.equals(pluginName) && !artifactId.equals(PLUGIN_PREFIX + pluginName)) {
        throw new MojoFailureException("The plugin name in the pom.xml [" + artifactId + "]" + " is not the expected '" + pluginName + "' or '" + PLUGIN_PREFIX + pluginName + "'. " + "Please correct the pom.xml or the plugin " + "descriptor.");
    }
    final String pomVersion = version.trim();
    final String grailsVersion = grailsProject.getVersion();
    if (!grailsVersion.equals(pomVersion)) {
        throw new MojoFailureException("The version specified in the plugin descriptor " + "[" + grailsVersion + "] is different from the version in the pom.xml [" + pomVersion + "] ");
    }
}
Also used : GrailsPluginProject(org.grails.maven.plugin.tools.GrailsPluginProject) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 GrailsPluginProject (org.grails.maven.plugin.tools.GrailsPluginProject)1