本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom類的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom類的具體用法?Java Xpp3Dom怎麽用?Java Xpp3Dom使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Xpp3Dom類屬於org.codehaus.plexus.util.xml包,在下文中一共展示了Xpp3Dom類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReportPluginPropertyImpl
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
private static @CheckForNull <T> T getReportPluginPropertyImpl(@NonNull MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull ConfigurationBuilder<T> builder, @NullAllowed String report) {
T toRet = null;
for (ReportPlugin plug : getEffectiveReportPlugins(prj)) {
if (artifactId.equals(plug.getArtifactId()) &&
groupId.equals(plug.getGroupId())) {
if (plug.getReportSets() != null) {
for (ReportSet exe : plug.getReportSets()) {
if (exe.getReports().contains(report)) {
toRet = builder.build((Xpp3Dom)exe.getConfiguration(), DUMMY_EVALUATOR);
if (toRet != null) {
break;
}
}
}
}
if (toRet == null) {
toRet = builder.build((Xpp3Dom)plug.getConfiguration(), DUMMY_EVALUATOR);
}
}
}
return toRet;
}
示例2: simpleProperty
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
static @NonNull ConfigurationBuilder<String> simpleProperty(final @NonNull String property) {
return new ConfigurationBuilder<String>() {
@Override
public String build(Xpp3Dom configRoot, ExpressionEvaluator eval) {
if (configRoot != null) {
Xpp3Dom source = configRoot.getChild(property);
if (source != null) {
String value = source.getValue();
if (value == null) {
return null;
}
return value.trim();
}
}
return null;
}
};
}
示例3: listProperty
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
static @NonNull ConfigurationBuilder<String[]> listProperty(final @NonNull String multiProperty, final @NonNull String singleProperty) {
return new ConfigurationBuilder<String[]>() {
@Override
public String[] build(Xpp3Dom conf, ExpressionEvaluator eval) {
if (conf != null) {
Xpp3Dom dom = (Xpp3Dom) conf; // MNG-4862
Xpp3Dom source = dom.getChild(multiProperty);
if (source != null) {
List<String> toRet = new ArrayList<String>();
Xpp3Dom[] childs = source.getChildren(singleProperty);
for (Xpp3Dom ch : childs) {
String chvalue = ch.getValue() == null ? "" : ch.getValue().trim(); //NOI18N
toRet.add(chvalue); //NOI18N
}
return toRet.toArray(new String[toRet.size()]);
}
}
return null;
}
};
}
示例4: getNonFilteredFileExtensions
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
private List<String> getNonFilteredFileExtensions(List<Plugin> plugins) {
for (Plugin plugin : plugins) {
if (MAVEN_RESOURCES_PLUGIN.equals(plugin.getArtifactId())) {
final Object configuration = plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom xpp3Dom = (Xpp3Dom) configuration;
final Xpp3Dom nonFilteredFileExtensions = xpp3Dom.getChild(NON_FILTERED_FILE_EXTENSIONS);
List<String> nonFilteredFileExtensionsList = new ArrayList<>();
final Xpp3Dom[] children = nonFilteredFileExtensions.getChildren();
for (Xpp3Dom child : children) {
nonFilteredFileExtensionsList.add(child.getValue());
}
return nonFilteredFileExtensionsList;
}
}
}
return null;
}
示例5: getValueFromServerConfiguration
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
/**
* Get string value from server configuration section in settings.xml.
*
* @param server Server object.
* @param key Key string.
* @return String value if key exists; otherwise, return null.
*/
public static String getValueFromServerConfiguration(final Server server, final String key) {
if (server == null) {
return null;
}
final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
if (configuration == null) {
return null;
}
final Xpp3Dom node = configuration.getChild(key);
if (node == null) {
return null;
}
return node.getValue();
}
示例6: getEnforcerPlugin
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
public Plugin getEnforcerPlugin(MavenProject project)
throws MavenExecutionException {
StringBuilder configString = new StringBuilder()
.append("<configuration><rules>")
.append("<requireReleaseDeps><message>No Snapshots Allowed!</message><excludes><exclude>"+project.getGroupId()+":*</exclude></excludes></requireReleaseDeps>")
.append("</rules></configuration>");
Xpp3Dom config = null;
try {
config = Xpp3DomBuilder.build(new StringReader(configString.toString()));
} catch (XmlPullParserException | IOException ex) {
throw new MavenExecutionException("Issue creating cofig for enforcer plugin", ex);
}
PluginExecution execution = new PluginExecution();
execution.setId("no-snapshot-deps");
execution.addGoal("enforce");
execution.setConfiguration(config);
Plugin result = new Plugin();
result.setArtifactId("maven-enforcer-plugin");
result.setVersion("1.4.1");
result.addExecution(execution);
return result;
}
示例7: updateModelBase
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
/**
* Method updateModelBase
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
//CHECKSTYLE_OFF: LineLength
protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element )
{
boolean shouldExist = value != null;
Element root = updateElement( counter, element, xmlTag, shouldExist );
if ( shouldExist )
{
Counter innerCount = new Counter( counter.getDepth() + 1 );
findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories",
"pluginRepository" );
iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
updateReporting( value.getReporting(), "reporting", innerCount, root );
updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
}
示例8: updatePlugin
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
/**
* Method updatePlugin
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updatePlugin( Plugin value, String xmlTag, Counter counter, Element element )
{
Element root = element;
Counter innerCount = new Counter( counter.getDepth() + 1 );
findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" );
findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
findAndReplaceSimpleElement( innerCount, root, "extensions",
!value.isExtensions() ? null : String.valueOf( value.isExtensions() ), "false" );
iteratePluginExecution( innerCount, root, value.getExecutions(), "executions", "execution" );
iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() );
findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
}
示例9: updateProfile
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
/**
* Method updateProfile
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
{
Element root = element;
Counter innerCount = new Counter( counter.getDepth() + 1 );
findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
// updateActivation( value.getActivation(), "activation", innerCount, root);
updateBuildBase( value.getBuild(), "build", innerCount, root );
findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
updateReporting( value.getReporting(), "reporting", innerCount, root );
updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
示例10: 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;
}
示例11: getCompileTargetVersion
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
/**
* Determines the Java compiler target version by inspecting the project's maven-compiler-plugin
* configuration.
*
* @return The Java compiler target version.
*/
public String getCompileTargetVersion() {
// maven-plugin-compiler default is 1.5
String javaVersion = "1.5";
if (mavenProject != null) {
// check the maven.compiler.target property first
String mavenCompilerTargetProperty = mavenProject.getProperties()
.getProperty("maven.compiler.target");
if (mavenCompilerTargetProperty != null) {
javaVersion = mavenCompilerTargetProperty;
} else {
Plugin compilerPlugin = mavenProject
.getPlugin("org.apache.maven.plugins:maven-compiler-plugin");
if (compilerPlugin != null) {
Xpp3Dom config = (Xpp3Dom) compilerPlugin.getConfiguration();
if (config != null) {
Xpp3Dom domVersion = config.getChild("target");
if (domVersion != null) {
javaVersion = domVersion.getValue();
}
}
}
}
}
return javaVersion;
}
示例12: executePluginDef
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
private void executePluginDef(InputStream is) throws Exception {
Xpp3Dom pluginDef = Xpp3DomBuilder.build(is, "utf-8");
Plugin plugin = loadPlugin(pluginDef);
Xpp3Dom config = pluginDef.getChild("configuration");
PluginDescriptor pluginDesc = pluginManager.loadPlugin(plugin,
mavenProject.getRemotePluginRepositories(),
mavenSession.getRepositorySession());
Xpp3Dom executions = pluginDef.getChild("executions");
for ( Xpp3Dom execution : executions.getChildren()) {
Xpp3Dom goals = execution.getChild("goals");
for (Xpp3Dom goal : goals.getChildren()) {
MojoDescriptor desc = pluginDesc.getMojo(goal.getValue());
pluginManager.executeMojo(mavenSession, new MojoExecution(desc, config));
}
}
}
示例13: findNodeWith
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入依賴的package包/類
@CheckForNull
private Xpp3Dom findNodeWith(String key) {
String[] keyParts = key.split("/");
Xpp3Dom node = configuration;
for (String keyPart : keyParts) {
if (node.getChildren(removeIndexSnippet(keyPart)).length <= getIndex(keyPart)) {
return null;
}
node = node.getChildren(removeIndexSnippet(keyPart))[getIndex(keyPart)];
if (node == null) {
return null;
}
}
return node;
}
示例14: 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;
}
示例15: 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);
}