/** * Create plugin descriptors for the given plugins. * * @param plugins The plugins. * @param context The scanner context. * @return The plugin descriptors. */ private List<MavenPluginDescriptor> createMavenPluginDescriptors( List<Plugin> plugins, ScannerContext context) { Store store = context.getStore(); List<MavenPluginDescriptor> pluginDescriptors = new ArrayList<>(); for (Plugin plugin : plugins) { MavenPluginDescriptor mavenPluginDescriptor = store.create(MavenPluginDescriptor.class); MavenArtifactDescriptor artifactDescriptor = getArtifactResolver(context).resolve(new PluginCoordinates(plugin), context); mavenPluginDescriptor.setArtifact(artifactDescriptor); mavenPluginDescriptor.setInherited(plugin.isInherited()); addDependencies( mavenPluginDescriptor, plugin.getDependencies(), PluginDependsOnDescriptor.class, context); addPluginExecutions(mavenPluginDescriptor, plugin, store); addConfiguration(mavenPluginDescriptor, (Xpp3Dom) plugin.getConfiguration(), store); pluginDescriptors.add(mavenPluginDescriptor); } return pluginDescriptors; }
/** * Adds information about plugin executions. * * @param mavenPluginDescriptor The descriptor for the plugin. * @param plugin The Plugin. * @param store The database. */ private void addPluginExecutions( MavenPluginDescriptor mavenPluginDescriptor, Plugin plugin, Store store) { List<PluginExecution> executions = plugin.getExecutions(); for (PluginExecution pluginExecution : executions) { MavenPluginExecutionDescriptor executionDescriptor = store.create(MavenPluginExecutionDescriptor.class); executionDescriptor.setId(pluginExecution.getId()); executionDescriptor.setPhase(pluginExecution.getPhase()); executionDescriptor.setInherited(pluginExecution.isInherited()); mavenPluginDescriptor.getExecutions().add(executionDescriptor); addExecutionGoals(executionDescriptor, pluginExecution, store); addConfiguration(executionDescriptor, (Xpp3Dom) pluginExecution.getConfiguration(), store); } }