protected void useCleanPlugin ( Element ... elements ) throws MojoExecutionException { List < Element > tempElems = new ArrayList <> ( Arrays . asList ( elements ) ) ; tempElems . add ( new Element ( "excludeDefaultDirectories" , "true" ) ) ; // Configure the Maven Clean Plugin to clean working files executeMojo ( plugin ( groupId ( "org.apache.maven.plugins" ) , artifactId ( "maven-clean-plugin" ) , version ( "2.5" ) ) , goal ( "clean" ) , configuration ( tempElems . toArray ( new Element [ tempElems . size ( ) ] ) ) , executionEnvironment ( project , session , pluginManager ) ) ; }
Utility method to use the clean plugin in the cleanup methods