本文整理汇总了Java中org.codehaus.plexus.util.xml.Xpp3Dom.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Xpp3Dom.setValue方法的具体用法?Java Xpp3Dom.setValue怎么用?Java Xpp3Dom.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.xml.Xpp3Dom
的用法示例。
在下文中一共展示了Xpp3Dom.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJavadocPlugin
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private static Plugin getJavadocPlugin() {
final Plugin javadocPlugin = new Plugin();
javadocPlugin.setGroupId("org.apache.maven.plugins");
javadocPlugin.setArtifactId("maven-javadoc-plugin");
//javadocPlugin.setVersion("2.10.4");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId("javadoc");
List<String> goals = new ArrayList<>();
goals.add("jar");
pluginExecution.setGoals(goals);
pluginExecution.setPhase("package");
List<PluginExecution> pluginExecutions = new ArrayList<>();
pluginExecutions.add(pluginExecution);
javadocPlugin.setExecutions(pluginExecutions);
final Xpp3Dom javadocConfig = new Xpp3Dom("configuration");
final Xpp3Dom quiet = new Xpp3Dom("quiet");
quiet.setValue("true");
javadocConfig.addChild(quiet);
javadocPlugin.setConfiguration(javadocConfig);
return javadocPlugin;
}
示例2: addExcludedGroups
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private Xpp3Dom addExcludedGroups(Xpp3Dom configNode) {
for (Xpp3Dom config : configNode.getChildren()) {
if ("excludedGroups".equals(config.getName())) {
Logger.getGlobal().log(Level.INFO, "Adding excluded groups to existing ones");
String current = config.getValue();
// Should not add duplicate entry for NonDexIgnore
if (current.contains("edu.illinois.NonDexIgnore")) {
return configNode;
}
current = "," + current;
// It seems there is an error if you have the variable
// in the excludedGroups string concatenated (in any
// position) to the concrete class we are adding to
// the excludedGroups
// ${excludedGroups} appears when
// there is no excludedGroups specified in the pom
// and potentially in other situations
current = current.replace(",${excludedGroups}", "");
config.setValue("edu.illinois.NonDexIgnore" + current);
return configNode;
}
}
Logger.getGlobal().log(Level.INFO, "Adding excluded groups to newly created one");
configNode.addChild(this.makeNode("excludedGroups", "edu.illinois.NonDexIgnore"));
return configNode;
}
示例3: setupArgline
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
protected void setupArgline(Xpp3Dom configNode) {
// create the NonDex argLine for surefire based on the current configuration
// this adds things like where to save test reports, what directory NonDex
// should store results in, what seed and mode should be used.
String argLineToSet = this.configuration.toArgLine();
boolean added = false;
for (Xpp3Dom config : configNode.getChildren()) {
if ("argLine".equals(config.getName())) {
Logger.getGlobal().log(Level.INFO, "Adding NonDex argLine to existing argLine specified by the project");
String current = sanitizeAndRemoveEnvironmentVars(config.getValue());
config.setValue(argLineToSet + " " + current);
added = true;
break;
}
}
if (!added) {
Logger.getGlobal().log(Level.INFO, "Creating new argline for Surefire");
configNode.addChild(this.makeNode("argLine", argLineToSet));
}
// originalArgLine is the argLine set from Maven, not through the surefire config
// if such an argLine exists, we modify that one also
this.mavenProject.getProperties().setProperty("argLine",
this.originalArgLine + " " + argLineToSet);
}
示例4: addDetails
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@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);
}
}
示例5: newElement
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
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(t.getMessage());
Xpp3Dom stackTraceElt = new Xpp3Dom("stackTrace");
rootElt.addChild(stackTraceElt);
StringWriter stackTrace = new StringWriter();
t.printStackTrace(new PrintWriter(stackTrace, true));
messageElt.setValue(stackTrace.toString());
return rootElt;
}
示例6: fullClone
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Nullable
protected Xpp3Dom fullClone(@Nonnull String elementName, @Nullable Xpp3Dom element) {
if (element == null) {
return null;
}
Xpp3Dom result = new Xpp3Dom(elementName);
Xpp3Dom[] childs = element.getChildren();
if (childs != null && childs.length > 0) {
for (Xpp3Dom child : childs) {
result.addChild(fullClone(child.getName(), child));
}
} else {
result.setValue(element.getValue() == null ? element.getAttribute("default-value") : element.getValue());
}
return result;
}
示例7: _handle
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
protected boolean _handle(MavenExecutionResult result) {
Xpp3Dom root = new Xpp3Dom("MavenExecutionResult");
root.setAttribute("class", result.getClass().getName());
for (MavenProject project : result.getTopologicallySortedProjects()) {
BuildSummary summary = result.getBuildSummary(project);
if (summary == null) {
Xpp3Dom comment = new Xpp3Dom("comment");
comment.setValue("No build summary found for maven project: " + project);
root.addChild(comment);
} else {
Xpp3Dom buildSummary = newElement("buildSummary", project);
root.addChild(buildSummary);
buildSummary.setAttribute("class", summary.getClass().getName());
buildSummary.setAttribute("time", Long.toString(summary.getTime()));
}
}
for(Throwable throwable: result.getExceptions()) {
root.addChild(newElement("exception", throwable));
}
reporter.print(root);
return true;
}
示例8: addPlugins
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
protected void addPlugins(MavenProject artifactMavenProject, Artifact artifact) {
Plugin plugin = CAppMavenUtils.createPluginEntry(artifactMavenProject,"org.wso2.maven","maven-car-plugin",WSO2MavenPluginConstantants.MAVEN_CAR_PLUGIN_VERSION,true);
Xpp3Dom configuration = (Xpp3Dom)plugin.getConfiguration();
//add configuration
Xpp3Dom aritfact = CAppMavenUtils.createConfigurationNode(configuration,"archiveLocation");
aritfact.setValue(archiveLocation);
if (finalName != null && !finalName.trim().equals("")) {
Xpp3Dom finalNameNode =
CAppMavenUtils.createConfigurationNode(configuration,
"finalName");
if (!finalName.endsWith(".car")) {
finalNameNode.setValue(finalName);
} else {
finalNameNode.setValue(finalName.substring(0, finalName.length() - 4));
}
}
}
示例9: processChildren
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
* Recursively process the DOM elements to inline any property values from the model.
* @param userProperties
* @param model
* @param parent
*/
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 " + child.getValue() + " with " + replacement );
child.setValue( replacement );
}
}
}
}
示例10: toXppDom
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
* Recursively convert PLEXUS config to Xpp3Dom.
* @param config The config to convert
* @return The Xpp3Dom document
* @see #execute(String,String,Properties)
*/
private Xpp3Dom toXppDom(final PlexusConfiguration config) {
final Xpp3Dom result = new Xpp3Dom(config.getName());
result.setValue(config.getValue(null));
for (final String name : config.getAttributeNames()) {
try {
result.setAttribute(name, config.getAttribute(name));
} catch (final PlexusConfigurationException ex) {
throw new IllegalArgumentException(ex);
}
}
for (final PlexusConfiguration child : config.getChildren()) {
result.addChild(this.toXppDom(child));
}
return result;
}
示例11: createPlugin
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private Plugin createPlugin( String groupId, String artifactId, String version, Map configuration )
{
Plugin plugin = new Plugin();
plugin.setGroupId( groupId );
plugin.setArtifactId( artifactId );
plugin.setVersion( version );
Xpp3Dom config = new Xpp3Dom( "configuration" );
if( configuration != null )
{
for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
Xpp3Dom param = new Xpp3Dom( String.valueOf( entry.getKey() ) );
param.setValue( String.valueOf( entry.getValue() ) );
config.addChild( param );
}
}
plugin.setConfiguration( config );
return plugin;
}
示例12: getNewCompilerPlugin
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
protected Plugin getNewCompilerPlugin() {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGINS));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN_VERSION));
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(compiler.name().toLowerCase());
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
execution.setConfiguration(configuration);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
示例13: disableMavenCompilerAlreadyPresent
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
protected void disableMavenCompilerAlreadyPresent(Plugin plugin) {
Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN);
skipMain.setValue(TRUE);
Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP);
skip.setValue(TRUE);
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(skipMain);
configuration.addChild(skip);
plugin.setConfiguration(configuration);
PluginExecution exec = new PluginExecution();
exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE);
exec.setPhase(MavenConfig.MAVEN_PHASE_NONE);
List<PluginExecution> executions = new ArrayList<>();
executions.add(exec);
plugin.setExecutions(executions);
}
示例14: getArrayParameters
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
public static Xpp3Dom getArrayParameters(String name, String... params) {
Xpp3Dom dom = new Xpp3Dom(name);
for (String param : params) {
Xpp3Dom paramNode = new Xpp3Dom("param");
paramNode.setValue(param);
dom.addChild(paramNode);
}
return dom;
}
示例15: setValue
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private static void setValue( Xpp3Dom dom, String element, String value )
{
Xpp3Dom child = dom.getChild( element );
if ( child == null || value == null || value.length() <= 0 )
{
return;
}
child.setValue( value );
}
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:12,代码来源:ComponentsXmlResourceTransformer.java