Using a Post Build Script

Here is an example of how the Invoker Plugin can be used to run a set of Maven projects and then verify their output with a BeanShell script. The name of the script file in this case is verify.bsh.


Here is an example post build script (verify.bsh) that checks for the existence of a JAR file after the build has run. If the JAR file does not exist, the script returns false which causes the Invoker Plugin to log that the build failed. The global variable basedir of type can be used to refer to the base directory of the current integration test.


    File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" );
    if ( !file.isFile() )
        System.err.println( "Could not find generated JAR: " + file );
        return false;
catch( Throwable t )
    return false;

return true;