------ Using a Post Build Script ------ Paul Gier ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html 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 <<>>. ------------------- maven-invoker-plugin ${project.version} true src/it **/pom.xml **/child*/pom.xml **/module*/pom.xml verify.bsh integration-test run ------------------- Here is an example post build script (<<>>) that checks for the existence of a JAR file after the build has run. If the JAR file does not exist, the script returns <<>> which causes the Invoker Plugin to log that the build failed. The global variable <<>> of type <<>> can be used to refer to the base directory of the current integration test. ------------------- import java.io.*; try { 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 ) { t.printStackTrace(); return false; } return true; -------------------