• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Xpp3DomBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.codehaus.plexus.util.xml.Xpp3DomBuilder的典型用法代码示例。如果您正苦于以下问题:Java Xpp3DomBuilder类的具体用法?Java Xpp3DomBuilder怎么用?Java Xpp3DomBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Xpp3DomBuilder类属于org.codehaus.plexus.util.xml包,在下文中一共展示了Xpp3DomBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Override
public synchronized void execute () throws MojoExecutionException
{
    fillFromProperties ( "nameProviderMap", this.nameProviderMap );
    fillFromProperties ( "nameProviderProperties", this.nameProviderProperties );

    getLog ().info ( "Name provider properties: " + this.nameProviderProperties );
    getLog ().info ( "Name provider mappings: " + this.nameProviderMap );

    if ( this.execution.getPlugin ().getConfiguration () == null )
    {
        // inject dummy configuration, otherwise the jgit provider will fail with a NPE
        try
        {
            this.execution.getPlugin ().setConfiguration ( Xpp3DomBuilder.build ( new StringReader ( "<configuration/>" ) ) );
        }
        catch ( final Exception e )
        {
            throw new RuntimeException ( e );
        }
    }

    super.execute ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:25,代码来源:GenerateQualifierMojo.java


示例2: getEnforcerPlugin

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的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


示例3: testGetEnforcerPlugin

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testGetEnforcerPlugin()
        throws MavenExecutionException,
        XmlPullParserException,
        IOException {
    Plugin result = item.getEnforcerPlugin();

    Assert.assertEquals("GroupId", "org.apache.maven.plugins", result.getGroupId());
    Assert.assertEquals("ArtifactId", "maven-enforcer-plugin", result.getArtifactId());
    Assert.assertEquals("Version", "1.4.1", result.getVersion());
    Assert.assertEquals("Executions.Size", 1, result.getExecutions().size());

    PluginExecution execution = result.getExecutions().get(0);
    Assert.assertEquals("Executions[0].Id", "no-snapshot-deps", execution.getId());
    Assert.assertEquals("Executions[0].Goals.Size", 1, execution.getGoals().size());
    Assert.assertEquals("Executions[0].Goals[0]", "enforce", execution.getGoals().get(0));

    Assert.assertEquals("Executions[0].Configuration",
            Xpp3DomBuilder.build(new StringReader("<configuration><rules><requireReleaseDeps><message>No Snapshots Allowed!</message></requireReleaseDeps></rules></configuration>")),
            execution.getConfiguration());
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:22,代码来源:PluginsTest.java


示例4: executePluginDef

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的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


示例5: testClean

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testClean() throws Exception {

   final Xpp3Dom cleanConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "setup-clean-mojo-config.xml" ), "UTF-8" );
   cleanConfig.getChild( "filesets" ).getChild( 0 ).getChild( "directory" ).setValue( helper.workingDir.getCanonicalPath() );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( cleanConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.clean();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:SetUpMojoTest.java


示例6: testUnpack

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testUnpack() throws Exception {
   final Xpp3Dom unpackConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "unpack-mojo-config.xml" ), "UTF-8" );
   unpackConfig.getChild( "artifactItems" ).getChild( 0 ).getChild( "outputDirectory" ).setValue( helper.workingDir.getCanonicalPath() );
   unpackConfig.getChild( "artifactItems" ).getChild( 1 ).getChild( "outputDirectory" ).setValue( helper.workingDir.getCanonicalPath() + "/FitNesseRoot/files" );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( unpackConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.unpack();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:SetUpMojoTest.java


示例7: testMove

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testMove() throws Exception {

   final Xpp3Dom antrunConfig = Xpp3DomBuilder.build( SetUpMojoTest.class.getResourceAsStream( "antrun-mojo-config.xml" ), "UTF-8" );
   // Because the tmp directory differs by OS
   antrunConfig.getChild( "target" ).getChild( 0 ).setAttribute( "todir", helper.workingDir.getCanonicalPath() );
   antrunConfig.getChild( "target" ).getChild( 0 ).setAttribute( "file", helper.workingDir.getCanonicalPath() + "/" + SetUpMojo.FIT_ROOT );
   antrunConfig.getChild( "target" ).getChild( 1 ).setAttribute( "todir", helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files" );
   antrunConfig.getChild( "target" ).getChild( 1 ).getChild( "fileset" ).setAttribute( "dir",
         helper.workingDir.getCanonicalPath() + "/" + FitNesseHelper.DEFAULT_ROOT + "/files/" + SetUpMojo.FIT_FILES );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( antrunConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( mojo.pluginManager ).executeMojo( eq( mojo.session ), any( MojoExecution.class ) );

   mojo.move();
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:22,代码来源:SetUpMojoTest.java


示例8: testExecute

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testExecute() throws Exception {
   final Xpp3Dom cleanConfig = Xpp3DomBuilder.build( TearDownMojoTest.class.getResourceAsStream( "teardown-clean-mojo-config.xml" ), "UTF-8" );

   doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
         assertEquals( cleanConfig, ((MojoExecution) invocation.getArguments()[1]).getConfiguration() );
         return null;
      }
   } ).when( helper.mojo.pluginManager ).executeMojo( eq( helper.mojo.session ), any( MojoExecution.class ) );

   helper.mojo.execute();

   verify( helper.mojo.pluginManager, times( 1 ) ).executeMojo( eq( helper.mojo.session ), any( MojoExecution.class ) );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:17,代码来源:TearDownMojoTest.java


示例9: patchGwtModule

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的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());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:ProcessExcludesMojo.java


示例10: configurePitMojo

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
protected void configurePitMojo(final AbstractPitMojo pitMojo, final String config)
    throws Exception {
  final Xpp3Dom xpp3dom = Xpp3DomBuilder.build(new StringReader(config));
  final PlexusConfiguration pluginConfiguration = extractPluginConfiguration(
      "pitest-maven", xpp3dom);

  // default the report dir to something
  setVariableValueToObject(pitMojo, "reportsDirectory", new File("."));

  configureMojo(pitMojo, pluginConfiguration);

  final Map<String, Artifact> pluginArtifacts = new HashMap<>();
  setVariableValueToObject(pitMojo, "pluginArtifactMap", pluginArtifacts);

  setVariableValueToObject(pitMojo, "project", this.project);

  ArrayList<String> elements = new ArrayList<>();
  setVariableValueToObject(pitMojo, "additionalClasspathElements", elements);

}
 
开发者ID:hcoles,项目名称:pitest,代码行数:21,代码来源:BasePitMojoTest.java


示例11: getConfigXml

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
private Xpp3Dom getConfigXml( final Node node )
    throws ManipulationException
{
    final String config = galleyWrapper.toXML( node.getOwnerDocument(), false )
                                       .trim();

    try
    {
        return Xpp3DomBuilder.build( new StringReader( config ) );
    }
    catch ( final XmlPullParserException | IOException e )
    {
        throw new ManipulationException(
                                         "Failed to re-parse plugin configuration into Xpp3Dom: %s\nConfig was:\n%s",
                                         e, e.getMessage(), config );
    }
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:18,代码来源:DistributionEnforcingManipulator.java


示例12: testShouldOverwritePluginConfigurationSubItemsByDefault

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
public void testShouldOverwritePluginConfigurationSubItemsByDefault()
    throws XmlPullParserException, IOException
{
    String parentConfigStr = "<configuration><items><item>one</item><item>two</item></items></configuration>";
    Xpp3Dom parentConfig = Xpp3DomBuilder.build( new StringReader( parentConfigStr ) );

    Plugin parentPlugin = createPlugin( "group", "artifact", "1", null );
    parentPlugin.setConfiguration( parentConfig );

    String childConfigStr = "<configuration><items><item>three</item></items></configuration>";
    Xpp3Dom childConfig = Xpp3DomBuilder.build( new StringReader( childConfigStr ) );

    Plugin childPlugin = createPlugin( "group", "artifact", "1", null );
    childPlugin.setConfiguration( childConfig );

    ModelUtils.mergePluginDefinitions( childPlugin, parentPlugin, true );

    Xpp3Dom result = (Xpp3Dom) childPlugin.getConfiguration();
    Xpp3Dom items = result.getChild( "items" );

    assertEquals( 1, items.getChildCount() );

    Xpp3Dom item = items.getChild( 0 );
    assertEquals( "three", item.getValue() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:ModelUtilsTest.java


示例13: initialValue

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
protected Map<String,String> initialValue() {
  Map<String, String> map = new HashMap<String, String>();
  ClasspathResourceMap resources = scanner.matchResource(".*[.]gwt[.]*xml")
      .scan(Thread.currentThread().getContextClassLoader());
  for (StringDataResource resource : resources.findResources("", GWT_XML_PATTERN)) {
    try {
      Xpp3Dom dom = Xpp3DomBuilder.build(resource.open(), "UTF-8");
      String rename = dom.getAttribute("rename-to");
      if (rename != null) {
        String resName = resource.getResourceName().replace('/', '.');
        resName = resName.substring(0, resName.lastIndexOf("gwt")-1);
        map.put(rename, resName);
        X_Log.trace("Found gwt module rename; ", rename," -> ",resName);
      }
    } catch (Exception e) {
      X_Log.error("Error reading xml from ",resource.getResourceName(),e
          ,"\nSet xapi.log.level=TRACE to see the faulty xml");
      X_Log.trace("Faulty xml: ",resource.readAll());
    }
  };
  return map;
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:23,代码来源:RemoteClasspathServiceImpl.java


示例14: findModules

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
private void findModules(File rootFile, File f, Collection<String> into) throws FileNotFoundException,
      XmlPullParserException, IOException {
      if (f.isDirectory()) {
        for (File child : f.listFiles(gwt_xml_filter)) {
          findModules(rootFile, child, into);
        }
      } else if (f.getName().endsWith(".gwt.xml")) {
        getLog().debug("Checking for entry points in " + f);
        // try to get entry points
        Xpp3Dom dom = Xpp3DomBuilder.build(new FileReader(f));
        getLog().debug(dom.toString());
        for (Xpp3Dom entry : dom.getChildren("entry-point")) {
          String attr = entry.getAttribute("class");
          if (null != attr && attr.length() > 0) {
//            into.add(attr.substring(0,
//                attr.lastIndexOf('.', attr.lastIndexOf('.') - 1))
//                + "." + f.getName().replace(".gwt.xml", ""));
            String mod = f.getAbsolutePath().substring(rootFile.getAbsolutePath().length()+1);
            into.add(mod.replace('/', '.').replace(".gwt.xml", ""));
          }
        }
      }
    }
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:24,代码来源:CodeServerMojo.java


示例15: findModule

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
private String findModule(File f) throws FileNotFoundException,
    XmlPullParserException, IOException {
  if (f.isDirectory()) {
    String module;
    for (File child : f.listFiles(gwt_xml_filter)) {
      module = findModule(child);
      if (module != null) {
        return module;
      }
    }
  } else if (f.getName().endsWith(".gwt.xml")) {
    getLog().debug("Checking for entry points in " + f);
    // try to get entry points
    Xpp3Dom dom = Xpp3DomBuilder.build(new FileReader(f));
    getLog().debug(dom.toString());
    for (Xpp3Dom entry : dom.getChildren("entry-point")) {
      String attr = entry.getAttribute("class");
      if (null != attr && attr.length() > 0) {
        return attr.substring(0,
            attr.lastIndexOf('.', attr.lastIndexOf('.') - 1))
            + "." + f.getName().replace(".gwt.xml", "");
      }
    }
  }
  return null;
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:27,代码来源:CodeServerMojo.java


示例16: readDOM

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
/**
 * Reads a source file into DOM, defaulting to a packaged resource if the
 * source file does not already exist.
 * 
 * @param sourceFile
 *            the source file to be parsed
 * @param resourcePath
 *            the default packaged resource
 * 
 * @return the parsed DOM
 */
private Xpp3Dom readDOM(File sourceFile, String resourcePath)
		throws IOException, XmlPullParserException {
	Reader reader = null;
	try {
		if (!force && sourceFile.exists()) {
			// parse the existing source file
			reader = new FileReader(sourceFile);
		} else {
			// parse the default resource file
			URL resource = getClass().getResource(resourcePath);

			// ensure that the resourcePath can be found
			if (resource == null)
				throw new IOException("Unable to read resource: "
						+ resourcePath);

			reader = new InputStreamReader(resource.openStream());
		}
		return Xpp3DomBuilder.build(reader);
	} finally {
		IOUtil.close(reader);
	}
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:35,代码来源:JDeveloperMojo.java


示例17: asXpp3Dom

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
public Xpp3Dom asXpp3Dom(String config) throws MavenExecutionException {
	try {
		return Xpp3DomBuilder.build(new StringReader(config));
	} catch (Exception e) {
		throw new MavenExecutionException("Error parsing config", e);
	}
}
 
开发者ID:commsen,项目名称:EM,代码行数:8,代码来源:MavenConfig.java


示例18: getModuleDom

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
private Xpp3Dom getModuleDom() throws UnsupportedEncodingException, IOException, XmlPullParserException {
    //TODO convert to FileOBject and have the IO stream from there..
    File file = getModuleXmlLocation();
    if (!file.exists()) {
        return null;
    }
    FileInputStream is = new FileInputStream(file);
    Reader reader = new InputStreamReader(is, "UTF-8"); //NOI18N
    try {
        return Xpp3DomBuilder.build(reader);
    } finally {
        IOUtil.close(reader);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:MavenNbModuleImpl.java


示例19: testLoadXml

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
@Test
public void testLoadXml() throws XmlPullParserException, IOException {
    InputStream is = this.getClass().getResourceAsStream("/plugins.xml");
    Xpp3Dom pluginDef = Xpp3DomBuilder.build(is, "utf-8");
    Plugin plugin = new GenerateMojo().loadPlugin(pluginDef);
    Assert.assertEquals("org.apache.aries.blueprint", plugin.getGroupId());
    Assert.assertEquals("blueprint-maven-plugin", plugin.getArtifactId());
    Assert.assertEquals("1.4.0", plugin.getVersion());
}
 
开发者ID:apache,项目名称:karaf-boot,代码行数:10,代码来源:PluginLoaderTest.java


示例20: parseDom

import org.codehaus.plexus.util.xml.Xpp3DomBuilder; //导入依赖的package包/类
/**
 * Parses input into {@link Xpp3Dom}, returns {@code null} if input not parsable. Passed in {@link InputStream} is
 * closed always on return.
 */
@Nullable
public static Xpp3Dom parseDom(final InputStream is) throws IOException {
  try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
    return Xpp3DomBuilder.build(reader);
  }
  catch (XmlPullParserException e) {
    log.debug("Could not parse XML into Xpp3Dom", e);
    return null;
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:15,代码来源:MavenModels.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommitCommand类代码示例发布时间:2022-05-21
下一篇:
Java Storage类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap