Java Code Examples for org.codehaus.plexus.util.xml.Xpp3Dom#setValue()
The following examples show how to use
org.codehaus.plexus.util.xml.Xpp3Dom#setValue() .
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: DeployDeployExecutionHandler.java From pipeline-maven-plugin with MIT License | 6 votes |
@Override protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) { super.addDetails(executionEvent, root); ArtifactRepository artifactRepository = executionEvent.getProject().getDistributionManagementArtifactRepository(); Xpp3Dom artifactRepositoryElt = new Xpp3Dom("artifactRepository"); root.addChild(artifactRepositoryElt); if (artifactRepository == null) { } else { Xpp3Dom idElt = new Xpp3Dom("id"); idElt.setValue(artifactRepository.getId()); artifactRepositoryElt.addChild(idElt); Xpp3Dom urlElt = new Xpp3Dom("url"); urlElt.setValue(artifactRepository.getUrl()); artifactRepositoryElt.addChild(urlElt); } }
Example 2
Source File: ModelIO.java From pom-manipulation-ext with Apache License 2.0 | 6 votes |
/** * Recursively process the DOM elements to inline any property values from the model. */ private void processChildren( Properties userProperties, Model model, Xpp3Dom parent ) { for ( int i = 0; i < parent.getChildCount(); i++ ) { Xpp3Dom child = parent.getChild( i ); if ( child.getChildCount() > 0 ) { processChildren( userProperties, model, child ); } if ( child.getValue() != null && child.getValue().startsWith( "${" ) ) { String replacement = resolveProperty( userProperties, model.getProperties(), child.getValue() ); if ( replacement != null && !replacement.isEmpty() ) { logger.debug( "Replacing child value {} with {}", child.getValue(), replacement ); child.setValue( replacement ); } } } }
Example 3
Source File: CreateMavenDataServicePom.java From tesb-studio-se with Apache License 2.0 | 6 votes |
private Plugin addOsgiHelperMavenPlugin() { Plugin plugin = new Plugin(); plugin.setGroupId("org.talend.ci"); plugin.setArtifactId("osgihelper-maven-plugin"); plugin.setVersion(VersionUtils.getMojoVersion("osgihelper.version")); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom featuresFile = new Xpp3Dom("featuresFile"); featuresFile.setValue("${basedir}/src/main/resources/feature/feature.xml"); configuration.addChild(featuresFile); List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>(); PluginExecution pluginExecution = new PluginExecution(); pluginExecution.setId("feature-helper"); pluginExecution.setPhase("generate-sources"); pluginExecution.addGoal("generate"); pluginExecution.setConfiguration(configuration); pluginExecutions.add(pluginExecution); plugin.setExecutions(pluginExecutions); return plugin; }
Example 4
Source File: CreateMavenBundlePom.java From tesb-studio-se with Apache License 2.0 | 6 votes |
/** * Skip clean control-bundle file in target folde, in case of using mvn clean + package goal * * @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: 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 6
Source File: AbstractMavenEventHandler.java From pipeline-maven-plugin with MIT License | 5 votes |
public Xpp3Dom newElement(@Nonnull String name, @Nullable File file) { Xpp3Dom element = new Xpp3Dom(name); try { element.setValue(file == null ? null : file.getCanonicalPath()); } catch (IOException e) { throw new RuntimeIOException(e); } return element; }
Example 7
Source File: StartDebugMojoSupport.java From ci.maven with Apache License 2.0 | 5 votes |
protected void runLibertyMojoDeploy(boolean forceLooseApp) throws MojoExecutionException { Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(getLibertyPlugin(), "deploy", log); if(forceLooseApp) { Xpp3Dom looseApp = config.getChild("looseApplication"); if (looseApp != null && "false".equals(looseApp.getValue())) { log.warn("Overriding liberty plugin pararmeter, \"looseApplication\" to \"true\" and deploying application in looseApplication format"); looseApp.setValue("true"); } } runLibertyMojo("deploy", config); }
Example 8
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 9
Source File: MavenHelper.java From sarl with Apache License 2.0 | 5 votes |
/** Convert a Plexus configuration to its XML equivalent. * * @param config the Plexus configuration. * @return the XML configuration. * @throws PlexusConfigurationException in case of problem. * @since 0.8 */ public Xpp3Dom toXpp3Dom(PlexusConfiguration config) throws PlexusConfigurationException { final Xpp3Dom result = new Xpp3Dom(config.getName()); result.setValue(config.getValue(null)); for (final String name : config.getAttributeNames()) { result.setAttribute(name, config.getAttribute(name)); } for (final PlexusConfiguration child : config.getChildren()) { result.addChild(toXpp3Dom(child)); } return result; }
Example 10
Source File: AppengineEnhancerMojo.java From appengine-maven-plugin with Apache License 2.0 | 5 votes |
private Xpp3Dom convertPlexusConfiguration(PlexusConfiguration config) { Xpp3Dom xpp3DomElement = new Xpp3Dom(config.getName()); xpp3DomElement.setValue(config.getValue()); for (String name : config.getAttributeNames()) { xpp3DomElement.setAttribute(name, config.getAttribute(name)); } for (PlexusConfiguration child : config.getChildren()) { xpp3DomElement.addChild(convertPlexusConfiguration(child)); } return xpp3DomElement; }
Example 11
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 12
Source File: AppengineEnhancerMojo.java From gcloud-maven-plugin with Apache License 2.0 | 5 votes |
private Xpp3Dom convertPlexusConfiguration(PlexusConfiguration config) { Xpp3Dom xpp3DomElement = new Xpp3Dom(config.getName()); xpp3DomElement.setValue(config.getValue()); for (String name : config.getAttributeNames()) { xpp3DomElement.setAttribute(name, config.getAttribute(name)); } for (PlexusConfiguration child : config.getChildren()) { xpp3DomElement.addChild(convertPlexusConfiguration(child)); } return xpp3DomElement; }
Example 13
Source File: RequirePropertyDiverges.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
private void addToMapWhenNotNull( String member, final String memberName ) { if ( member != null ) { final Xpp3Dom memberDom = new Xpp3Dom( memberName ); memberDom.setValue( member ); map.put( memberName, memberDom ); } }
Example 14
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 15
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 16
Source File: AbstractDockerMojoTest.java From docker-maven-plugin with Apache License 2.0 | 5 votes |
private Server mockServer() { final Server server = new Server(); server.setUsername(USERNAME); server.setPassword(PASSWORD); final Xpp3Dom email = new Xpp3Dom(EMAIL_PROPERTY); email.setValue(EMAIL); final Xpp3Dom configuration = new Xpp3Dom(CONFIGURATION_PROPERTY); configuration.addChild(email); server.setConfiguration(configuration); return server; }
Example 17
Source File: TomeeServer.java From microprofile-starter with Apache License 2.0 | 5 votes |
private void adjustPOM(Model pomFile, JessieModel model, boolean mainProject) { Profile profile = pomFile.getProfiles().get(0);// We assume there is only 1 profile. Plugin mavenPlugin = findMavenPlugin(profile.getBuild().getPlugins()); Xpp3Dom configuration = (Xpp3Dom) mavenPlugin.getConfiguration(); Xpp3Dom httpPort = new Xpp3Dom("tomeeHttpPort"); httpPort.setValue( mainProject ? SupportedServer.TOMEE.getPortServiceA() : SupportedServer.TOMEE.getPortServiceB() ); configuration.addChild(httpPort); Xpp3Dom shutdownPort = new Xpp3Dom("tomeeShutdownPort"); shutdownPort.setValue( mainProject ? "8005" : "8105" ); configuration.addChild(shutdownPort); Xpp3Dom ajpPort = new Xpp3Dom("tomeeAjpPort"); ajpPort.setValue( mainProject ? "8009" : "8109" ); configuration.addChild(ajpPort); List<MicroprofileSpec> microprofileSpecs = model.getParameter(JessieModel.Parameter.MICROPROFILESPECS); if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH) && !mainProject) { Xpp3Dom systemVariables = new Xpp3Dom("systemVariables"); Xpp3Dom publicKeyLocation = new Xpp3Dom("mp.jwt.verify.publickey.location"); publicKeyLocation.setValue("/publicKey.pem"); systemVariables.addChild(publicKeyLocation); configuration.addChild(systemVariables); } }
Example 18
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 19
Source File: QuarkusServer.java From microprofile-starter with Apache License 2.0 | 4 votes |
@Override public void adaptMavenModel(Model pomFile, JessieModel model, boolean mainProject) { String quarkusVersion = ""; switch (model.getSpecification().getMicroProfileVersion()) { case NONE: break; case MP32: quarkusVersion = "1.3.4.Final"; break; case MP30: break; case MP22: break; case MP21: break; case MP20: break; case MP14: break; case MP13: break; case MP12: break; default: } pomFile.addProperty("version.quarkus", quarkusVersion); List<MicroprofileSpec> microprofileSpecs = model.getParameter(JessieModel.Parameter.MICROPROFILESPECS); Profile nativeProfile = pomFile.getProfiles().get(0).clone(); nativeProfile.setId("native"); nativeProfile.getActivation().setActiveByDefault(false); nativeProfile.getBuild().getPlugins().get(0).getExecutions().get(0).setGoals(Collections.singletonList("native-image")); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom enableHttpUrlHandler = new Xpp3Dom("enableHttpUrlHandler"); enableHttpUrlHandler.setValue("true"); configuration.addChild(enableHttpUrlHandler); if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH) && mainProject) { Xpp3Dom additionalBuildArgsLog = new Xpp3Dom("additionalBuildArgs"); additionalBuildArgsLog.setValue("-H:Log=registerResource:"); configuration.addChild(additionalBuildArgsLog); Xpp3Dom additionalBuildArgsResources = new Xpp3Dom("additionalBuildArgs"); additionalBuildArgsResources.setValue("-H:IncludeResources=privateKey.pem"); configuration.addChild(additionalBuildArgsResources); } nativeProfile.getBuild().getPlugins().get(0).setConfiguration(configuration); pomFile.addProfile(nativeProfile); // We add Rest by default as all our examples use it anyway. mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-resteasy", "${version.quarkus}"); //if (microprofileSpecs.contains(MicroprofileSpec.CONFIG)) { // Config is present by default. //} if (microprofileSpecs.contains(MicroprofileSpec.FAULT_TOLERANCE) && mainProject) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-fault-tolerance", "${version.quarkus}"); } if (microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH)) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-jwt", "${version.quarkus}"); } if (microprofileSpecs.contains(MicroprofileSpec.METRICS) && mainProject) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-metrics", "${version.quarkus}"); } if (microprofileSpecs.contains(MicroprofileSpec.HEALTH_CHECKS) && mainProject) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-health", "${version.quarkus}"); } if (microprofileSpecs.contains(MicroprofileSpec.OPEN_API) && mainProject) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-openapi", "${version.quarkus}"); } if (microprofileSpecs.contains(MicroprofileSpec.OPEN_TRACING)) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-smallrye-opentracing", "${version.quarkus}"); } if ((microprofileSpecs.contains(MicroprofileSpec.REST_CLIENT) || microprofileSpecs.contains(MicroprofileSpec.JWT_AUTH)) && mainProject) { mavenHelper.addDependency(pomFile, "io.quarkus", "quarkus-rest-client", "${version.quarkus}"); } }
Example 20
Source File: CompileJdtClasspathVisibilityTest.java From takari-lifecycle with Eclipse Public License 1.0 | 4 votes |
private static Xpp3Dom param(String name, String value) { Xpp3Dom node = new Xpp3Dom(name); node.setValue(value); return node; }