本文整理汇总了Java中org.codehaus.plexus.util.xml.Xpp3Dom.addChild方法的典型用法代码示例。如果您正苦于以下问题:Java Xpp3Dom.addChild方法的具体用法?Java Xpp3Dom.addChild怎么用?Java Xpp3Dom.addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.xml.Xpp3Dom
的用法示例。
在下文中一共展示了Xpp3Dom.addChild方法的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: addDetails
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@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());
}
}
示例8: createRuleListWithNameSortedChildren
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
* As Xpp3Dom is very picky about the order of children while comparing, create a new list where the children
* are added in alphabetical order. See <a href="https://jira.codehaus.org/browse/MOJO-1931">MOJO-1931</a>.
*
* @param originalListFromPom order not specified
* @return a list where children's member are alphabetically sorted.
*/
private List<Xpp3Dom> createRuleListWithNameSortedChildren( final List<Xpp3Dom> originalListFromPom )
{
final List<Xpp3Dom> listWithSortedEntries = new ArrayList<Xpp3Dom>( originalListFromPom.size() );
for ( Xpp3Dom unsortedXpp3Dom : originalListFromPom )
{
final Xpp3Dom sortedXpp3Dom = new Xpp3Dom( getRuleName() );
final SortedMap<String, Xpp3Dom> childrenMap = new TreeMap<String, Xpp3Dom>();
final Xpp3Dom[] children = unsortedXpp3Dom.getChildren();
for ( Xpp3Dom child : children )
{
childrenMap.put( child.getName(), child );
}
for ( Xpp3Dom entry : childrenMap.values() )
{
sortedXpp3Dom.addChild( entry );
}
listWithSortedEntries.add( sortedXpp3Dom );
}
return listWithSortedEntries;
}
示例9: 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;
}
示例10: replaceTechnologiesScopes
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceTechnologiesScopes(String projectName,
Xpp3Dom projectDOM) {
String[] defaultTechnologies = { "ADF_FACES", "ADFbc", "ADFm", "Ant",
"HTML", "JAVASCRIPT", "JSF", "JSP", "Java", "JSP", "Maven",
"XML" };
Xpp3Dom technologyDOM = findNamedChild(projectDOM, "hash",
"oracle.ide.model.TechnologyScopeConfiguration");
Xpp3Dom technologyScopeDOM = findNamedChild(technologyDOM, "list",
"technologyScope");
String[] technologies = (this.technologiesScope != null && this.technologiesScope.length > 0) ? this.technologiesScope
: defaultTechnologies;
for (String techonology : technologies) {
Xpp3Dom scopeDOM = new Xpp3Dom("string");
scopeDOM.setAttribute("v", techonology);
technologyScopeDOM.addChild(scopeDOM);
}
}
示例11: createProjectReferenceDOM
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private Xpp3Dom createProjectReferenceDOM(File workspaceDir,
File projectFile) {
Xpp3Dom hashDOM = new Xpp3Dom("hash");
Xpp3Dom urlDOM = new Xpp3Dom("url");
urlDOM.setAttribute("n", "URL");
urlDOM.setAttribute("path", getRelativeFile(workspaceDir, projectFile));
if (_releaseMajor < 11) {
Xpp3Dom valueDOM = new Xpp3Dom("value");
valueDOM.setAttribute("n", "nodeClass");
valueDOM.setAttribute("v", "oracle.jdeveloper.model.JProject");
hashDOM.addChild(valueDOM);
}
hashDOM.addChild(urlDOM);
return hashDOM;
}
示例12: 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;
}
示例13: replaceOutputDirectory
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceOutputDirectory(File projectDir, File outputDir,
Xpp3Dom projectDOM) throws XmlPullParserException {
// /jpr:project
// /hash[@n="oracle.jdevimpl.config.JProjectPaths"]
Xpp3Dom projectPathsDOM = findNamedChild(projectDOM, "hash",
"oracle.jdevimpl.config.JProjectPaths");
Xpp3Dom sourceDOM = new Xpp3Dom("url");
//
// <url @n="outputDirectory" path="[relative-path-to-output-dir]" />
//
sourceDOM.setAttribute("path", getRelativeDir(projectDir, outputDir));
sourceDOM.setAttribute("n", "outputDirectory");
projectPathsDOM.addChild(sourceDOM);
}
示例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: getTransformedResource
import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
byte[] getTransformedResource()
throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream( 1024 * 4 );
Writer writer = WriterFactory.newXmlWriter( baos );
try
{
Xpp3Dom dom = new Xpp3Dom( "component-set" );
Xpp3Dom componentDom = new Xpp3Dom( "components" );
dom.addChild( componentDom );
for ( Xpp3Dom component : components.values() )
{
componentDom.addChild( component );
}
Xpp3DomWriter.write( writer, dom );
writer.close();
writer = null;
}
finally
{
IOUtil.close( writer );
}
return baos.toByteArray();
}
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:32,代码来源:ComponentsXmlResourceTransformer.java