本文整理了Java中org.gradle.api.XmlProvider
类的一些代码示例,展示了XmlProvider
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlProvider
类的具体详情如下:
包路径:org.gradle.api.XmlProvider
类名称:XmlProvider
暂无
代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin
@Override
public void execute(XmlProvider xmlProvider) {
configurePom(xmlProvider.asNode());
}
代码示例来源:origin: MinecraftForge/ForgeGradle
public Object call(Object... obj)
{
Element root = ((XmlProvider) this.getDelegate()).asElement();
Document doc = root.getOwnerDocument();
try
{
injectIntellijRuns(doc, project.getProjectDir().getCanonicalPath());
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
});
代码示例来源:origin: diffplug/goomph
@SuppressWarnings("unchecked")
private void classic(XmlProvider xmlProvider) {
Node classpathNode = xmlProvider.asNode();
Iterator<Node> classpathEntries = classpathNode.children().iterator();
while (classpathEntries.hasNext()) {
Node entry = classpathEntries.next();
String kind = (String) entry.attribute("kind");
if ("output".equals(kind)) {
entry.attributes().put("path", "bin");
} else if ("src".equals(kind)) {
entry.attributes().remove("output");
entry.children().clear();
}
}
}
}
代码示例来源:origin: me.seeber.gradle/gradle-project-config
Element root = xml.asElement();
NodeList classpathentries = root.getElementsByTagName("classpathentry");
代码示例来源:origin: diffplug/goomph
@SuppressWarnings("unchecked")
@Override
protected void applyOnce(Project project) {
extension = project.getExtensions().create(ResourceFiltersExtension.NAME, ResourceFiltersExtension.class);
EclipseProjectPlugin.modifyEclipseProject(project, eclipseModel -> {
eclipseModel.getProject().getFile().getXmlTransformer().addAction(xmlProvider -> {
Node rootNode = (Node) xmlProvider.asNode();
// remove the old filteredResources
List<Node> toRemove = ((List<Node>) rootNode.children()).stream()
.filter(Objects::nonNull)
.filter(node -> FILTERED_RESOURCES.equals(node.name()))
.collect(Collectors.toList());
toRemove.forEach(rootNode::remove);
// now add ours
Node filteredResources = rootNode.appendNode(FILTERED_RESOURCES);
for (ResourceFilter toExclude : extension.filters) {
toExclude.appendToFilteredResources(filteredResources);
}
});
});
}
代码示例来源:origin: gradle.plugin.me.seeber.gradle/gradle-project-config
Element root = xml.asElement();
NodeList classpathentries = root.getElementsByTagName("classpathentry");
代码示例来源:origin: palantir/gradle-baseline
Node rootNode = xmlProvider.asNode();
Node scalaCompilerConf = (Node) rootNode
.getAt(new QName("component"))
代码示例来源:origin: me.seeber.gradle/gradle-project-config
Element pom = xml.asElement();
代码示例来源:origin: diffplug/goomph
Node entry = xmlProvider.asNode().appendNode("classpathentry");
entry.attributes().put("kind", "src");
entry.attributes().put("path", "");
代码示例来源:origin: gradle.plugin.me.seeber.gradle/gradle-project-config
Element pom = xml.asElement();
代码示例来源:origin: diffplug/goomph
@Override
protected void applyOnce(Project project) {
ProjectDepsExtension extension = project.getExtensions().create(ProjectDepsExtension.NAME, ProjectDepsExtension.class);
EclipseProjectPlugin.modifyEclipseProject(project, eclipseModel -> {
// find the project's referenced projects and reference them explicitly in the eclipse model
Task prepareEclipse = project.task("prepareEclipse");
prepareEclipse.doLast(task -> {
Set<String> referencedProjects = eclipseModel.getProject().getReferencedProjects();
project.getConfigurations().stream()
.flatMap(config -> config.getDependencies().stream())
.filter(dep -> dep instanceof ProjectDependency)
.forEach(dep -> {
referencedProjects.add(dep.getName());
});
});
// it's needed for generating the eclipseClasspath and eclipseProject
Iterables.getOnlyElement(project.getTasksByName("eclipseClasspath", false)).dependsOn(prepareEclipse);
Iterables.getOnlyElement(project.getTasksByName("eclipseProject", false)).dependsOn(prepareEclipse);
// create robust classpath entries for all referenced projects
eclipseModel.getClasspath().getFile().getXmlTransformer().addAction(xmlProvider -> {
modifyClasspath(xmlProvider.asNode(), eclipseModel, extension);
});
});
}
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
public void execute(XmlProvider xml) {
String archivesBaseName = (String) project.getProperties().get("archivesBaseName");
File contributorsFile = contributorsFile(project);
LOG.info(" Read project contributors from file: " + contributorsFile.getAbsolutePath());
// It can happens that contributorsFile doesn't exist e.g. when shipkit.team.contributors is NOT empty
ProjectContributorsSet contributorsFromGitHub = new AllContributorsSerializer()
.deserialize(IOUtil.readFullyOrDefault(contributorsFile, "[]"));
LOG.info(" Customizing pom for publication " + publication.getName() + " in " + project.toString() +
"\n - Module name (project.archivesBaseName): " + archivesBaseName +
"\n - Description (project.description): " + project.getDescription() +
"\n - GitHub repository (project.rootProject.shipkit.gitHub.repository): "
+ conf.getGitHub().getRepository() +
"\n - Developers (project.rootProject.shipkit.team.developers): "
+ StringUtil.join(conf.getTeam().getDevelopers(), ", ") +
"\n - Contributors (project.rootProject.shipkit.team.contributors): "
+ StringUtil.join(conf.getTeam().getContributors(), ", ") +
"\n - Contributors read from GitHub: "
+ StringUtil.join(contributorsFromGitHub.toConfigNotation(), ", "));
customizePom(xml.asNode(), conf, archivesBaseName, project.getDescription(), contributorsFromGitHub);
}
});
代码示例来源:origin: org.shipkit/shipkit
public void execute(XmlProvider xml) {
String archivesBaseName = (String) project.getProperties().get("archivesBaseName");
File contributorsFile = contributorsFile(project);
LOG.info(" Read project contributors from file: " + contributorsFile.getAbsolutePath());
// It can happens that contributorsFile doesn't exist e.g. when shipkit.team.contributors is NOT empty
ProjectContributorsSet contributorsFromGitHub = new ProjectContributorsSerializer()
.deserialize(IOUtil.readFullyOrDefault(contributorsFile, "[]"));
LOG.info(" Customizing pom for publication " + publication.getName() + " in " + project.toString() +
"\n - Module name (project.archivesBaseName): " + archivesBaseName +
"\n - Description (project.description): " + project.getDescription() +
"\n - GitHub repository (project.rootProject.shipkit.gitHub.repository): "
+ conf.getGitHub().getRepository() +
"\n - Developers (project.rootProject.shipkit.team.developers): "
+ StringUtil.join(conf.getTeam().getDevelopers(), ", ") +
"\n - Contributors (project.rootProject.shipkit.team.contributors): "
+ StringUtil.join(conf.getTeam().getContributors(), ", ") +
"\n - Contributors read from GitHub: "
+ StringUtil.join(contributorsFromGitHub.toConfigNotation(), ", "));
customizePom(xml.asNode(), conf, archivesBaseName, project.getDescription(), contributorsFromGitHub);
}
});
代码示例来源:origin: mockito/shipkit
public void execute(XmlProvider xml) {
String archivesBaseName = (String) project.getProperties().get("archivesBaseName");
File contributorsFile = contributorsFile(project);
LOG.info(" Read project contributors from file: " + contributorsFile.getAbsolutePath());
// It can happens that contributorsFile doesn't exist e.g. when shipkit.team.contributors is NOT empty
ProjectContributorsSet contributorsFromGitHub = new ProjectContributorsSerializer()
.deserialize(IOUtil.readFullyOrDefault(contributorsFile, "[]"));
LOG.info(" Customizing pom for publication " + publication.getName() + " in " + project.toString() +
"\n - Module name (project.archivesBaseName): " + archivesBaseName +
"\n - Description (project.description): " + project.getDescription() +
"\n - GitHub repository (project.rootProject.shipkit.gitHub.repository): "
+ conf.getGitHub().getRepository() +
"\n - Developers (project.rootProject.shipkit.team.developers): "
+ StringUtil.join(conf.getTeam().getDevelopers(), ", ") +
"\n - Contributors (project.rootProject.shipkit.team.contributors): "
+ StringUtil.join(conf.getTeam().getContributors(), ", ") +
"\n - Contributors read from GitHub: "
+ StringUtil.join(contributorsFromGitHub.toConfigNotation(), ", "));
customizePom(xml.asNode(), conf, archivesBaseName, project.getDescription(), contributorsFromGitHub);
}
});
内容来源于网络,如有侵权,请联系作者删除!