private static Xpp3Dom getMojoConfiguration( Plugin plugin ) { // // We need to look in the configuration element, and then look for configuration elements // within the executions. // Xpp3Dom configuration = ( Xpp3Dom ) plugin.getConfiguration(); if ( configuration == null ) { if ( !plugin.getExecutions().isEmpty() ) { configuration = ( Xpp3Dom ) plugin.getExecutions().get( 0 ).getConfiguration(); } } return configuration; } }
dom = (Xpp3Dom) plugin.getConfiguration();
Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();
dom = (Xpp3Dom) plugin.getConfiguration();
setConfiguration( plugin.getConfiguration() );
private void expand( List<Plugin> plugins ) { for ( Plugin plugin : plugins ) { Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration(); if ( pluginConfiguration != null ) { for ( PluginExecution execution : plugin.getExecutions() ) { Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration(); executionConfiguration = Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) ); execution.setConfiguration( executionConfiguration ); } } } }
Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();
if ( plugin.getConfiguration() != null ) ((Xpp3Dom) plugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
public static Plugin clonePlugin( Plugin src ) { Plugin result = null; if ( src != null ) { result = new Plugin(); result.setArtifactId( src.getArtifactId() ); result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) ); result.setExecutions( cloneList( src.getExecutions(), PLUGIN_EXECUTION_CLONER ) ); result.setExtensions( src.isExtensions() ); result.setGroupId( src.getGroupId() ); result.setInherited( src.getInherited() ); result.setVersion( src.getVersion() ); } return result; }
@Override public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig ) { String g = mojoExecution.getGroupId(); String a = mojoExecution.getArtifactId(); Plugin plugin = findPlugin( g, a, project.getBuildPlugins() ); if ( plugin == null && project.getPluginManagement() != null ) { plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() ); } if ( plugin != null ) { PluginExecution pluginExecution = findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() ); Xpp3Dom pomConfiguration = null; if ( pluginExecution != null ) { pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration(); } else if ( allowPluginLevelConfig ) { pomConfiguration = (Xpp3Dom) plugin.getConfiguration(); } Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null; mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration ); mojoExecution.setConfiguration( mojoConfiguration ); } }
private ReportOptions updateFromSurefire(ReportOptions option) { Collection<Plugin> plugins = lookupPlugin("org.apache.maven.plugins:maven-surefire-plugin"); if (!this.mojo.isParseSurefireConfig()) { return option; } else if (plugins.isEmpty()) { this.log.warn("Could not find surefire configuration in pom"); return option; } Plugin surefire = plugins.iterator().next(); if (surefire != null) { return this.surefireConverter.update(option, (Xpp3Dom) surefire.getConfiguration()); } else { return option; } }
private void plugins(PrintWriter pw, String element, List<Plugin> plugins) { if (!plugins.isEmpty()) { for (int i = 0; i < plugins.size(); i++) { Plugin plugin = plugins.get(i); pw.println("\n" + element); pw.print(indent + "id: " + plugin.getGroupId() + ":" + plugin.getArtifactId()); if (plugin.getVersion() != null) { pw.print(":" + plugin.getVersion()); } if (plugin.getConfiguration() != null) { pw.println(); Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); printChildren(pw, configuration); } if (i + 1 != plugins.size()) { pw.println(); } } pw.println(); } }
Xpp3Dom configuration = (Xpp3Dom) sitePlugin.getConfiguration();
private String getSourceVersion(BuildBase build) { for (Plugin plugin : build.getPlugins()) { if (!"maven-compiler-plugin".equals(plugin.getArtifactId())) { continue; } Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); if (configuration != null) { Xpp3Dom source = configuration.getChild("source"); if (source != null) { return source.getValue(); } } break; } return null; }
private void writePlugin(Plugin plugin, String indent) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(plugin.getGroupId() + ":" + plugin.getArtifactId()); if (plugin.getVersion() != null) { sb.append(":" + plugin.getVersion()); } out.write(indent + "plugin(\"" + sb.toString() + "\")" + br); if (plugin.getExtensions() != null) { out.write(indent + " .extensions(" + plugin.getExtensions() + ")" + br); } if (plugin.getInherited() != null) { out.write(indent + " .inherited(" + plugin.getInherited() + ")" + br); } if (plugin.getDependencies() != null && !plugin.getDependencies().isEmpty()) { out.write(indent + " " + ".dependencies(" + br); writePluginDependency(plugin.getDependencies(), indent); out.write(indent + " " + ")" + br); } writeConfiguration((Xpp3Dom)plugin.getConfiguration(), indent); out.write(indent + ".endPlugin()" + br); }
/** * Template method for exporting shared libraries and packages. By default, the pom needs to be parsed again to find which * dependencies need to be shared. */ protected void doExportSharedLibrariesResourcesAndPackages(Plugin packagingPlugin) { Object configuration = packagingPlugin.getConfiguration(); if (configuration != null) { Xpp3Dom sharedLibrariesDom = ((Xpp3Dom) configuration).getChild(SHARED_LIBRARIES_FIELD); if (sharedLibrariesDom != null) { Xpp3Dom[] sharedLibraries = sharedLibrariesDom.getChildren(SHARED_LIBRARY_FIELD); if (sharedLibraries != null) { for (Xpp3Dom sharedLibrary : sharedLibraries) { String groupId = getAttribute(sharedLibrary, GROUP_ID); String artifactId = getAttribute(sharedLibrary, ARTIFACT_ID); findAndExportSharedLibrary(groupId, artifactId); } } } } }
return muleMavenPlugin; }); Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); if (configuration == null) { configuration = new Xpp3Dom("configuration");
if ( plugin.getConfiguration() != null ) ((Xpp3Dom) plugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer );
protected Map<BundleDescriptor, Set<BundleDescriptor>> doProcessAdditionalPluginLibraries(Plugin packagingPlugin) { Map<BundleDescriptor, Set<BundleDescriptor>> pluginsAdditionalLibraries = new HashMap<>(); Object configuration = packagingPlugin.getConfiguration(); if (configuration != null) { Xpp3Dom additionalPluginDependenciesDom = ((Xpp3Dom) configuration).getChild(ADDITIONAL_PLUGIN_DEPENDENCIES_FIELD);
if ( plugin != null ) configuration = (Xpp3Dom) plugin.getConfiguration();