public static Xpp3Dom getBuildPluginConfiguration ( AbstractWisdomMojo mojo , String artifactId , String goal ) { List < Plugin > plugins = mojo . project . getBuildPlugins ( ) ; Plugin plugin = null ; for ( Plugin plug : plugins ) { if ( plug . getArtifactId ( ) . equals ( artifactId ) ) { plugin = plug ; } } if ( plugin == null ) { // Not found return null ; } if ( goal != null ) { // Check main execution List < String > globalGoals = ( List < String > ) plugin . getGoals ( ) ; if ( globalGoals != null && globalGoals . contains ( goal ) ) { return ( Xpp3Dom ) plugin . getConfiguration ( ) ; } // Check executions for ( PluginExecution execution : plugin . getExecutions ( ) ) { if ( execution . getGoals ( ) . contains ( goal ) ) { return ( Xpp3Dom ) execution . getConfiguration ( ) ; } } } // Global configuration. return ( Xpp3Dom ) plugin . getConfiguration ( ) ; }
Retrieves the main configuration of the given plugin from the Maven Project .