protected List < PluginWrapper > getAllPluginEntries ( MavenProject project ) throws ArtifactResolutionException , ArtifactNotFoundException , IOException , XmlPullParserException { List < PluginWrapper > plugins = new ArrayList < PluginWrapper > ( ) ; // get all the pom models String pomName = null ; try { pomName = project . getFile ( ) . getName ( ) ; } catch ( Exception e ) { pomName = "pom.xml" ; } List < Model > models = utils . getModelsRecursively ( project . getGroupId ( ) , project . getArtifactId ( ) , project . getVersion ( ) , new File ( project . getBasedir ( ) , pomName ) ) ; // now find all the plugin entries, either in // build.plugins or build.pluginManagement.plugins, profiles.plugins and reporting for ( Model model : models ) { try { List < Plugin > modelPlugins = model . getBuild ( ) . getPlugins ( ) ; plugins . addAll ( PluginWrapper . addAll ( utils . resolvePlugins ( modelPlugins ) , model . getId ( ) + ".build.plugins" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } try { List < ReportPlugin > modelReportPlugins = model . getReporting ( ) . getPlugins ( ) ; // add the reporting plugins plugins . addAll ( PluginWrapper . addAll ( utils . resolveReportPlugins ( modelReportPlugins ) , model . getId ( ) + ".reporting" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } try { List < Plugin > modelPlugins = model . getBuild ( ) . getPluginManagement ( ) . getPlugins ( ) ; plugins . addAll ( PluginWrapper . addAll ( utils . resolvePlugins ( modelPlugins ) , model . getId ( ) + ".build.pluginManagement.plugins" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } // Add plugins in profiles @ SuppressWarnings ( "unchecked" ) List < Profile > profiles = model . getProfiles ( ) ; for ( Profile profile : profiles ) { try { List < Plugin > modelPlugins = profile . getBuild ( ) . getPlugins ( ) ; plugins . addAll ( PluginWrapper . addAll ( utils . resolvePlugins ( modelPlugins ) , model . getId ( ) + ".profiles.profile[" + profile . getId ( ) + "].build.plugins" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } try { List < ReportPlugin > modelReportPlugins = profile . getReporting ( ) . getPlugins ( ) ; // add the reporting plugins plugins . addAll ( PluginWrapper . addAll ( utils . resolveReportPlugins ( modelReportPlugins ) , model . getId ( ) + "profile[" + profile . getId ( ) + "].reporting.plugins" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } try { List < Plugin > modelPlugins = profile . getBuild ( ) . getPluginManagement ( ) . getPlugins ( ) ; plugins . addAll ( PluginWrapper . addAll ( utils . resolvePlugins ( modelPlugins ) , model . getId ( ) + "profile[" + profile . getId ( ) + "].build.pluginManagement.plugins" ) ) ; } catch ( NullPointerException e ) { // guess there are no plugins here. } } } return plugins ; }
Gets all plugin entries in build . plugins build . pluginManagement . plugins profile . build . plugins reporting and profile . reporting in this project and all parents