Java Code Examples for org.codehaus.plexus.util.xml.Xpp3Dom#addChild()
The following examples show how to use
org.codehaus.plexus.util.xml.Xpp3Dom#addChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectStartedExecutionHandler.java From pipeline-maven-plugin with MIT License | 6 votes |
@Override protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) { super.addDetails(executionEvent, root); MavenProject parentProject = executionEvent.getProject().getParent(); if (parentProject == null) { // nothing to do } else { Xpp3Dom parentProjectElt = new Xpp3Dom("parentProject"); root.addChild(parentProjectElt); parentProjectElt.setAttribute("name", parentProject.getName()); parentProjectElt.setAttribute("groupId", parentProject.getGroupId()); parentProjectElt.setAttribute("artifactId", parentProject.getArtifactId()); parentProjectElt.setAttribute("version", parentProject.getVersion()); } }
Example 2
Source File: MavenCompilerUtilsTest.java From pgpverify-maven-plugin with Apache License 2.0 | 6 votes |
private static Xpp3Dom createPath(String groupId, String artifactId, String version) { final Xpp3Dom path = new Xpp3Dom("path"); if (groupId != null) { final Xpp3Dom groupIdNode = new Xpp3Dom("groupId"); groupIdNode.setValue(groupId); path.addChild(groupIdNode); } if (artifactId != null) { final Xpp3Dom artifactIdNode = new Xpp3Dom("artifactId"); artifactIdNode.setValue(artifactId); path.addChild(artifactIdNode); } if (version != null) { final Xpp3Dom versionNode = new Xpp3Dom("version"); versionNode.setValue(version); path.addChild(versionNode); } return path; }
Example 3
Source File: AbstractMavenEventHandler.java From pipeline-maven-plugin with MIT License | 6 votes |
public Xpp3Dom newElement(@Nonnull String name, @Nullable Throwable t) { Xpp3Dom rootElt = new Xpp3Dom(name); if (t == null) { return rootElt; } rootElt.setAttribute("class", t.getClass().getName()); Xpp3Dom messageElt = new Xpp3Dom("message"); rootElt.addChild(messageElt); messageElt.setValue(removeAnsiColor(t.getMessage())); Xpp3Dom stackTraceElt = new Xpp3Dom("stackTrace"); rootElt.addChild(stackTraceElt); StringWriter stackTrace = new StringWriter(); t.printStackTrace(new PrintWriter(stackTrace, true)); stackTraceElt.setValue(removeAnsiColor(stackTrace.toString())); return rootElt; }
Example 4
Source File: CreateMavenDataServicePom.java From tesb-studio-se with Apache License 2.0 | 6 votes |
/** * Avoid clean control-bundle file in target folde, in case of using mvn clean package, TESB-22296 * * @return plugin */ private Plugin addSkipMavenCleanPlugin() { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.maven.plugins"); plugin.setArtifactId("maven-clean-plugin"); plugin.setVersion("3.0.0"); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom skipClean = new Xpp3Dom("skip"); skipClean.setValue("true"); configuration.addChild(skipClean); plugin.setConfiguration(configuration); return plugin; }
Example 5
Source File: CreateMavenDataServicePom.java From tesb-studio-se with Apache License 2.0 | 6 votes |
private Plugin addControlBundleMavenPlugin() { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.maven.plugins"); plugin.setArtifactId("maven-jar-plugin"); plugin.setVersion("3.0.2"); plugin.setExtensions(true); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom archive = new Xpp3Dom("archive"); Xpp3Dom manifest = new Xpp3Dom("manifestFile"); manifest.setValue("${project.build.outputDirectory}/META-INF/MANIFEST.MF"); archive.addChild(manifest); configuration.addChild(archive); plugin.setConfiguration(configuration); return plugin; }
Example 6
Source File: MultiStartMojo.java From wildfly-swarm with Apache License 2.0 | 5 votes |
protected Xpp3Dom getProcessConfiguration(XmlPlexusConfiguration process) { Xpp3Dom config = new Xpp3Dom("configuration"); config.addChild(convert(process.getChild("properties"))); config.addChild(convert(process.getChild("environment"))); config.addChild(convert(process.getChild("jvmArguments"))); return config; }
Example 7
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
Xpp3Dom createPluginConfiguration() { final Xpp3Dom configuration = new Xpp3Dom( "configuration" ); final Xpp3Dom rules = new Xpp3Dom( "rules" ); final Xpp3Dom rule = new Xpp3Dom( instance.getRuleName() ); rules.addChild( rule ); final Xpp3Dom property = new Xpp3Dom( "property" ); property.setValue( "checkedProperty" ); rule.addChild( property ); final Xpp3Dom regex = new Xpp3Dom( "regex" ); regex.setValue( "parentValue" ); rule.addChild( regex ); configuration.addChild( rules ); return configuration; }
Example 8
Source File: AuthConfigFactoryTest.java From docker-maven-plugin with Apache License 2.0 | 5 votes |
private void setupServers() { new Expectations() {{ List<Server> servers = new ArrayList<>(); servers.add(create(ECR_NAME, "roland", "secret", "[email protected]")); servers.add(create("test.org", "fabric8io", "secret2", "[email protected]")); servers.add(create("test.org/roland", "roland", "secret", "[email protected]")); servers.add(create("docker.io", "tanja", "doublesecret", "[email protected]")); servers.add(create("another.repo.org/joe", "joe", "3secret", "[email protected]")); settings.getServers(); result = servers; } private Server create(String id, String user, String password, String email) { Server server = new Server(); server.setId(id); server.setUsername(user); server.setPassword(password); Xpp3Dom dom = new Xpp3Dom("configuration"); Xpp3Dom emailD = new Xpp3Dom("email"); emailD.setValue(email); dom.addChild(emailD); server.setConfiguration(dom); return server; } }; }
Example 9
Source File: SettingsStub.java From docker-maven-plugin with Apache License 2.0 | 5 votes |
public SettingsStub() { super(); final Server server = new Server(); server.setId("docker-hub"); server.setUsername("dxia3"); // plaintext value is: SxpxdUQA2mvX7oj server.setPassword("{gc4QPLrlgPwHZjAhPw8JPuGzaPitzuyjeBojwCz88j4=}"); final Xpp3Dom configuration = new Xpp3Dom("configuration"); final Xpp3Dom email = new Xpp3Dom("email"); email.setValue("[email protected]"); configuration.addChild(email); server.setConfiguration(configuration); addServer(server); }
Example 10
Source File: CompileTest.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
@Test public void testIncludes() throws Exception { Xpp3Dom includes = new Xpp3Dom("includes"); includes.addChild(newParameter("include", "basic/Basic.java")); File basedir = compile("compile/source-filtering", includes); mojos.assertBuildOutputs(new File(basedir, "target/classes"), "basic/Basic.class"); }
Example 11
Source File: MojoExecutionService.java From jkube with Eclipse Public License 2.0 | 5 votes |
private Xpp3Dom toXpp3Dom(PlexusConfiguration config) { Xpp3Dom result = new Xpp3Dom(config.getName()); result.setValue(config.getValue(null)); for (String name : config.getAttributeNames()) { result.setAttribute(name, config.getAttribute(name)); } for (PlexusConfiguration child : config.getChildren()) { result.addChild(toXpp3Dom(child)); } return result; }
Example 12
Source File: DevMojo.java From quarkus with Apache License 2.0 | 5 votes |
private Xpp3Dom getPluginConfig(Plugin plugin) { Xpp3Dom configuration = MojoExecutor.configuration(); Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration(); if (pluginConfiguration != null) { //Filter out `test*` configurations for (Xpp3Dom child : pluginConfiguration.getChildren()) { if (!child.getName().startsWith("test")) { configuration.addChild(child); } } } return configuration; }
Example 13
Source File: MojoUtils.java From quarkus with Apache License 2.0 | 5 votes |
public Xpp3Dom toDom() { Xpp3Dom dom = new Xpp3Dom(name); if (text != null) { dom.setValue(text); } for (Element e : children) { dom.addChild(e.toDom()); } for (Attribute attribute : attributes.attributes) { dom.setAttribute(attribute.name, attribute.value); } return dom; }
Example 14
Source File: CreateMavenBundlePom.java From tesb-studio-se with Apache License 2.0 | 5 votes |
private Plugin addFeaturesMavenPlugin(String finalNameValue) { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.karaf.tooling"); plugin.setArtifactId("karaf-maven-plugin"); plugin.setVersion("4.2.4"); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom finalName = new Xpp3Dom("finalName"); finalName.setValue(finalNameValue);// "${talend.job.finalName}" Xpp3Dom resourcesDir = new Xpp3Dom("resourcesDir"); resourcesDir.setValue("${project.build.directory}/bin"); Xpp3Dom featuresFile = new Xpp3Dom("featuresFile"); featuresFile.setValue(PATH_FEATURE); configuration.addChild(finalName); configuration.addChild(resourcesDir); configuration.addChild(featuresFile); List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>(); PluginExecution pluginExecution = new PluginExecution(); pluginExecution.setId("create-kar"); pluginExecution.addGoal("kar"); pluginExecution.setConfiguration(configuration); pluginExecutions.add(pluginExecution); plugin.setExecutions(pluginExecutions); return plugin; }
Example 15
Source File: PojoGenerationConfigTest.java From springmvc-raml-plugin with Apache License 2.0 | 5 votes |
private Mojo configureMojo(final String parameter, final String value) throws Exception { final MavenSession mavenSession = mojoRule.newMavenSession(getMavenProject(DEFAULT_CONFIG)); final MojoExecution mojoExecution = mojoRule.newMojoExecution(GOAL_NAME); final Xpp3Dom configuration = new Xpp3Dom("configuration"); final Xpp3Dom generationConfig = new Xpp3Dom("generationConfig"); final Xpp3Dom useBigDecimal = new Xpp3Dom(parameter); useBigDecimal.setValue(value); generationConfig.addChild(useBigDecimal); configuration.addChild(generationConfig); mojoExecution.setConfiguration(configuration); return mojoRule.lookupConfiguredMojo(mavenSession, mojoExecution); }
Example 16
Source File: LibertyRuntime.java From boost with Eclipse Public License 1.0 | 5 votes |
/** * Invoke the liberty-maven-plugin to run the install-app goal. */ private void installApp(String installAppPackagesVal) throws MojoExecutionException { Element deployPackages = element(name("deployPackages"), installAppPackagesVal); Element serverNameElement = element(name("serverName"), serverName); Xpp3Dom configuration = configuration(deployPackages, serverNameElement, getRuntimeArtifactElement()); configuration.addChild(element(name("appsDirectory"), "apps").toDom()); executeMojo(getPlugin(), goal("deploy"), configuration, env); }
Example 17
Source File: CreateMavenDataServicePom.java From tesb-studio-se with Apache License 2.0 | 4 votes |
private Plugin addSkipDeployFeatureMavenPlugin() { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.maven.plugins"); plugin.setArtifactId("maven-deploy-plugin"); plugin.setVersion("2.7"); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom skip = new Xpp3Dom("skip"); skip.setValue("true"); configuration.addChild(skip); plugin.setConfiguration(configuration); return plugin; }
Example 18
Source File: DependencyResolutionResultHandler.java From pipeline-maven-plugin with MIT License | 4 votes |
@Override protected boolean _handle(DependencyResolutionResult result) { Xpp3Dom root = new Xpp3Dom("DependencyResolutionResult"); root.setAttribute("class", result.getClass().getName()); Xpp3Dom dependenciesElt = new Xpp3Dom("resolvedDependencies"); root.addChild(dependenciesElt); for (Dependency dependency : result.getResolvedDependencies()) { Artifact artifact = dependency.getArtifact(); if ( !includedScopes.contains(dependency.getScope())) { continue; } if (!includeSnapshots && artifact.isSnapshot()) { continue; } if(!includeReleases && !artifact.isSnapshot()) { continue; } Xpp3Dom dependencyElt = new Xpp3Dom("dependency"); dependencyElt.addChild(newElement("file", artifact.getFile().getAbsolutePath())); dependencyElt.setAttribute("name", artifact.getFile().getName()); dependencyElt.setAttribute("groupId", artifact.getGroupId()); dependencyElt.setAttribute("artifactId", artifact.getArtifactId()); dependencyElt.setAttribute("version", artifact.getVersion()); dependencyElt.setAttribute("baseVersion", artifact.getBaseVersion()); if (artifact.getClassifier() != null) { dependencyElt.setAttribute("classifier", artifact.getClassifier()); } dependencyElt.setAttribute("type", artifact.getExtension()); dependencyElt.setAttribute("id", artifact.getArtifactId()); dependencyElt.setAttribute("extension", artifact.getExtension()); dependencyElt.setAttribute("scope", dependency.getScope()); dependencyElt.setAttribute("optional", Boolean.toString(dependency.isOptional())); dependencyElt.setAttribute("snapshot", Boolean.toString(artifact.isSnapshot())); dependenciesElt.addChild(dependencyElt); } reporter.print(root); return true; }
Example 19
Source File: DevMojo.java From ci.maven with Apache License 2.0 | 4 votes |
private void addDomPropertyIfNotFound(Xpp3Dom sysProps, String key, String value) { if (sysProps.getChild(key) == null && value != null) { sysProps.addChild(element(name(key), value).toDom()); } }
Example 20
Source File: MavenUtils.java From developer-studio with Apache License 2.0 | 4 votes |
public static Xpp3Dom createXpp3Node(Xpp3Dom parent,String tagName) { Xpp3Dom node = createXpp3Node(tagName); parent.addChild(node); return node; }