public void execute ( ) throws MojoExecutionException , MojoFailureException { if ( preverifyPath == null ) { getLog ( ) . debug ( "skip native preverification" ) ; return ; } getLog ( ) . debug ( "start native preverification" ) ; final File preverifyCmd = getAbsolutePreverifyCommand ( ) ; StreamConsumer stdoutLogger = new LogWriter ( false ) ; StreamConsumer stderrLogger = new LogWriter ( true ) ; String classPath = getClassPath ( getProject ( ) ) ; AbstractConfiguration [ ] configurations = ( AbstractConfiguration [ ] ) getPluginContext ( ) . get ( ConfiguratorMojo . GENERATED_CONFIGURATIONS_KEY ) ; for ( AbstractConfiguration configuration : configurations ) { if ( ! ( configuration instanceof NodeConfiguration ) ) { continue ; } String classifier = configuration . className . substring ( configuration . className . lastIndexOf ( ' ' ) + 1 ) ; File oldJar = checkJarFile ( classifier ) ; if ( keepJars ) { try { FileUtils . copyFile ( oldJar , getJarFile ( classifier + "-before_preverify" ) ) ; } catch ( IOException ioe ) { getLog ( ) . warn ( "could not keep old jar '" + oldJar . getAbsolutePath ( ) + "'" , ioe ) ; } } getLog ( ) . info ( "Preverifying jar: " + FileNameUtil . getAbsolutPath ( oldJar ) ) ; Commandline commandLine = new Commandline ( preverifyCmd . getPath ( ) + " -classpath " + classPath + " -d " + FileNameUtil . getAbsolutPath ( oldJar . getParentFile ( ) ) + " " + FileNameUtil . getAbsolutPath ( oldJar ) ) ; getLog ( ) . debug ( commandLine . toString ( ) ) ; try { if ( CommandLineUtils . executeCommandLine ( commandLine , stdoutLogger , stderrLogger ) != 0 ) { throw new MojoExecutionException ( "Preverification failed. Please read the log for details." ) ; } } catch ( CommandLineException cle ) { throw new MojoExecutionException ( "could not execute preverify command" , cle ) ; } } getLog ( ) . debug ( "finished preverification" ) ; }
The main method of this MoJo