当前位置: 首页>>代码示例>>Java>>正文


Java Xpp3Dom类代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:PluginPropertyUtils.java

示例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;
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PluginPropertyUtils.java

示例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;
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:PluginPropertyUtils.java

示例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;
}
 
开发者ID:wavemaker,项目名称:wavemaker-app-build-tools,代码行数:19,代码来源:AppBuildMojo.java

示例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();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:25,代码来源:Utils.java

示例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;
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:26,代码来源:Plugins.java

示例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() );
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:29,代码来源:MavenJDOMWriter.java

示例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() );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:24,代码来源:MavenJDOMWriter.java

示例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() );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:26,代码来源:MavenJDOMWriter.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:25,代码来源:MavenModelUtils.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:app-maven-plugin,代码行数:32,代码来源:CloudSdkMojo.java

示例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));
        }
    }
}
 
开发者ID:apache,项目名称:karaf-boot,代码行数:18,代码来源:GenerateMojo.java

示例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;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:18,代码来源:MavenPlugin.java

示例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;
}
 
开发者ID:TestingResearchIllinois,项目名称:NonDex,代码行数:27,代码来源:NonDexSurefireExecution.java

示例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);
}
 
开发者ID:TestingResearchIllinois,项目名称:NonDex,代码行数:27,代码来源:CleanSurefireExecution.java


注:本文中的org.codehaus.plexus.util.xml.Xpp3Dom类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。