import java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; File buildFile = new File( basedir, "maven-build.xml" ); String xml = FileUtils.fileRead( buildFile, "UTF-8" ); Matcher m = Pattern.compile( "]*?>" ).matcher( xml ); if ( !m.find() ) { throw new Exception( "Build script does not contain task." ); } if ( m.group().indexOf( "target=\"1.3\"" ) < 0 ) { throw new Exception( " does not define target=1.3" ); } if ( m.group().indexOf( "source=\"1.4\"" ) < 0 ) { throw new Exception( " does not define source=1.4" ); } return true;