本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom.getChild方法的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom.getChild方法的具體用法?Java Xpp3Dom.getChild怎麽用?Java Xpp3Dom.getChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.plexus.util.xml.Xpp3Dom
的用法示例。
在下文中一共展示了Xpp3Dom.getChild方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
};
}
示例2: 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;
}
};
}
示例3: 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;
}
示例4: 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();
}
示例5: 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;
}
示例6: 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));
}
}
}
示例7: resolveFromRootThenParent
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private String resolveFromRootThenParent(Xpp3Dom pluginPomDom, String element) throws Exception {
Xpp3Dom elementDom = pluginPomDom.getChild(element);
if (elementDom == null) {
Xpp3Dom pluginParentDom = pluginPomDom.getChild("parent");
if (pluginParentDom != null) {
elementDom = pluginParentDom.getChild(element);
if (elementDom == null) {
throw new Exception("unable to determine " + element);
} else {
return elementDom.getValue();
}
} else {
throw new Exception("unable to determine " + element);
}
} else {
return elementDom.getValue();
}
}
示例8: setPluginGoalPrefixFromConfiguration
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* If the plugin configurations contain a reference to the <code>maven-plugin-plugin</code> and that contains
* configuration of the <code>goalPrefix</code>, update the supplied plugin with that prefix.
*
* @param plugin the plugin to update.
* @param pluginConfigs the configurations of {@link org.apache.maven.model.Plugin} to search.
* @return <code>true</code> if the prefix has been set.
* @since 1.0
*/
private boolean setPluginGoalPrefixFromConfiguration( Plugin plugin, List<org.apache.maven.model.Plugin> pluginConfigs )
{
for ( org.apache.maven.model.Plugin def : pluginConfigs )
{
if ( ( def.getGroupId() == null || StringUtils.equals( "org.apache.maven.plugins", def.getGroupId() ) )
&& StringUtils.equals( "maven-plugin-plugin", def.getArtifactId() ) )
{
Xpp3Dom configuration = (Xpp3Dom) def.getConfiguration();
if ( configuration != null )
{
final Xpp3Dom goalPrefix = configuration.getChild( "goalPrefix" );
if ( goalPrefix != null )
{
plugin.setPrefix( goalPrefix.getValue() );
return true;
}
}
break;
}
}
return false;
}
示例9: setPluginGoalPrefixFromConfiguration
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private boolean setPluginGoalPrefixFromConfiguration( Plugin plugin, List<org.apache.maven.model.Plugin> pluginConfigs )
{
for ( org.apache.maven.model.Plugin def : pluginConfigs )
{
if ( ( def.getGroupId() == null || StringUtils.equals( "org.apache.maven.plugins", def.getGroupId() ) )
&& StringUtils.equals( "maven-plugin-plugin", def.getArtifactId() ) )
{
Xpp3Dom configuration = (Xpp3Dom) def.getConfiguration();
if ( configuration != null )
{
final Xpp3Dom goalPrefix = configuration.getChild( "goalPrefix" );
if ( goalPrefix != null )
{
plugin.setPrefix( goalPrefix.getValue() );
return true;
}
}
break;
}
}
return false;
}
示例10: patchGwtModule
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Patches the IDE GWT module by replacing inheritance of Full.gwt.xml by
* Full-with-excludes.gwt.xml.
*/
private void patchGwtModule() throws XmlPullParserException, IOException {
String gwtModuleFileRelPath = getGwtModule().replace('.', '/') + ".gwt.xml";
Path gwtModuleFilePath = Paths.get(outputDirectory.getPath(), gwtModuleFileRelPath);
Xpp3Dom module = Xpp3DomBuilder.build(Files.newInputStream(gwtModuleFilePath), UTF_8.name());
for (int i = module.getChildCount() - 1; i >= 0; i--) {
Xpp3Dom child = module.getChild(i);
if ("inherits".equals(child.getName())) {
String moduleName = child.getAttribute("name");
if (moduleName.equals(fullIdeGwtModule)) {
child.setAttribute("name", fullIdeGwtModule + FULL_IDE_GWT_MODULE_SUFFIX);
break;
}
}
}
try (Writer writer = new StringWriter()) {
XMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
Xpp3DomWriter.write(xmlWriter, module);
Files.write(gwtModuleFilePath, writer.toString().getBytes());
}
}
示例11: hasProjectNature
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Searches the Maven pom.xml for the given project nature.
*
* @param mavenProject a description of the Maven project
* @param natureId the nature to check
* @return {@code true} if the project
*/
protected boolean hasProjectNature(MavenProject mavenProject, String natureId) {
if (natureId == GWTNature.NATURE_ID || getGwtMavenPlugin(mavenProject) != null) {
return true;
}
// The use of the maven-eclipse-plugin is deprecated. The following code is
// only for backward compatibility.
Plugin plugin = getEclipsePlugin(mavenProject);
if (plugin != null) {
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom additionalBuildCommands = configuration.getChild("additionalProjectnatures");
if (additionalBuildCommands != null) {
for (Xpp3Dom projectNature : additionalBuildCommands.getChildren("projectnature")) {
if (projectNature != null && natureId.equals(projectNature.getValue())) {
return true;
}
}
}
}
}
return false;
}
示例12: getAuthors
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Lookup and returns the value of the <em>author</em> configuration.
* <p>
* The configuration string is split based on ',' so multiple authors can be
* defined.
*
* @param project project
* @return list of authors or null if not found
*/
protected static List<Author> getAuthors(MavenProject project) {
Plugin nbmPlugin = lookupNbmPlugin(project);
if (nbmPlugin != null) {
Xpp3Dom config = (Xpp3Dom) nbmPlugin.getConfiguration();
if (config != null && config.getChild("author") != null) {
String authorName = config.getChild("author").getValue();
String authorEmail = config.getChild("authorEmail") != null ? config.getChild("authorEmail").getValue() : null;
String authorUrl = config.getChild("authorUrl") != null ? config.getChild("authorUrl").getValue() : null;
Author author = new Author();
author.name = authorName;
author.email = authorEmail;
author.link = authorUrl;
return Arrays.asList(new Author[]{author});
}
}
return null;
}
示例13: getSourceCode
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Lookup source code configuration or default to SCM.
*
* @param project project
* @param log log
* @return source code url or null
*/
protected static String getSourceCode(MavenProject project, Log log) {
Plugin nbmPlugin = lookupNbmPlugin(project);
if (nbmPlugin != null) {
Xpp3Dom config = (Xpp3Dom) nbmPlugin.getConfiguration();
if (config != null && config.getChild("sourceCodeUrl") != null) {
return config.getChild("sourceCodeUrl").getValue();
}
}
Scm scm = project.getScm();
if (scm != null && scm.getUrl() != null && !scm.getUrl().isEmpty()) {
log.debug("SCM configuration found, with url = '" + scm.getUrl() + "'");
return scm.getUrl();
} else {
}
return null;
}
示例14: getOutputDir
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private File getOutputDir() {
File outputDir = new File(project.getBasedir(), "res");
List<Plugin> plugins = project.getBuildPlugins();
for (Plugin plugin : plugins) {
if (plugin.getGroupId().equals("com.jayway.maven.plugins.android.generation2") && plugin.getArtifactId().equals("android-maven-plugin")) {
Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();
Xpp3Dom resDir = dom.getChild("resourceDirectory");
if (resDir != null) {
outputDir = new File(resDir.getValue());
}
}
}
return outputDir;
}
示例15: getServiceUnitName
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
protected String getServiceUnitName(MavenProject project) {
for (Object elem : project.getBuildPlugins()) {
if (elem instanceof Plugin) {
Plugin plugin = (Plugin)elem;
if (plugin.getGroupId().equals("org.apache.servicemix.tooling")
&& plugin.getArtifactId().equals("jbi-maven-plugin")) {
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom serviceUnitName = configuration.getChild("serviceUnitName");
if (serviceUnitName != null) {
return serviceUnitName.getValue();
}
}
break;
}
}
}
return null;
}