All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.mvnmigrate.CheckCommandMojo Maven / Gradle / Ivy

Go to download

Migration-plugin is a Apache Maven 2 plugin that aims to integrate into the maven life cycle, the myBatis 3 Migration tool. myBatis 3 Migration Schema is a tool that helps you to manage database schema changes.

There is a newer version: 1.1
Show newest version
/*
 *    Copyright 2010 The maven-migrate-plugin Team
 *
 *    Licensed 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.
 */
package com.googlecode.mvnmigrate;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

/**
 * Goal which check the presence of pending migration.
 *
 * @goal check
 * @phase test
 * @version $Id: CheckCommandMojo.java 132 2010-07-10 17:23:54Z marco.speranza79 $
 */
public class CheckCommandMojo extends StatusCommandMojo {


    /**
     * {@inheritDoc}
     */
    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        if (isSkip()) return;

        init();

        if (getCommand() instanceof MigrationStatusCommand) {
            MigrationStatusCommand  mcommand = (MigrationStatusCommand) getCommand();
            boolean isPending = mcommand.checkPending();
            final String msg = "At last one pending script found. Type status command to more informations.";
            if ( isPending ) {
                throw new MojoExecutionException(msg);
            }
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy