本文整理汇总了Java中org.apache.ivy.core.module.descriptor.ModuleDescriptor.getInheritedDescriptors方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleDescriptor.getInheritedDescriptors方法的具体用法?Java ModuleDescriptor.getInheritedDescriptors怎么用?Java ModuleDescriptor.getInheritedDescriptors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.module.descriptor.ModuleDescriptor
的用法示例。
在下文中一共展示了ModuleDescriptor.getInheritedDescriptors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveLocalParents
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private void saveLocalParents(ModuleRevisionId baseMrevId, ModuleDescriptor md, File mdFile,
Properties paths) throws ParseException, IOException {
for (ExtendsDescriptor parent : md.getInheritedDescriptors()) {
if (!parent.isLocal()) {
// we store only local parents in the cache!
continue;
}
ModuleDescriptor parentMd = parent.getParentMd();
ModuleRevisionId pRevId = ModuleRevisionId.newInstance(baseMrevId,
baseMrevId.getRevision() + "-parent." + paths.size());
File parentFile = getResolvedIvyFileInCache(pRevId);
parentMd.toIvyFile(parentFile);
paths.setProperty(mdFile.getName() + "|" + parent.getLocation(),
parentFile.getAbsolutePath());
saveLocalParents(baseMrevId, parentMd, parentFile, paths);
}
}
示例2: testIVY1347
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
/**
* Test case for IVY-1347.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1347">IVY-1347</a>
*/
@Test
public void testIVY1347() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-1347/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport rr = ivy.resolve(new File(
"test/repositories/IVY-1347/childone/childtwo/ivy.xml"),
getResolveOptions(new String[] {"*"}));
ModuleDescriptor md = rr.getModuleDescriptor();
assertNotNull(md);
ExtendsDescriptor[] parents = md.getInheritedDescriptors();
assertNotNull(parents);
assertEquals(1, parents.length);
ModuleRevisionId parent = parents[0].getParentRevisionId();
assertEquals(ModuleRevisionId.newInstance("foo", "parent", "1.0"), parent);
}
示例3: write
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
public static void write(ModuleDescriptor md, String licenseHeader, File output)
throws IOException {
if (output.getParentFile() != null) {
output.getParentFile().mkdirs();
}
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output),
"UTF-8"))) {
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
if (licenseHeader != null) {
out.print(licenseHeader);
}
StringBuilder xmlNamespace = new StringBuilder();
Map<String, String> namespaces = md.getExtraAttributesNamespaces();
for (Map.Entry<String, String> ns : namespaces.entrySet()) {
xmlNamespace.append(" xmlns:").append(ns.getKey()).append("=\"")
.append(ns.getValue()).append("\"");
}
String version = "2.0";
if (md.getInheritedDescriptors().length > 0) {
version = "2.2";
}
out.println("<ivy-module version=\"" + version + "\"" + xmlNamespace + ">");
printInfoTag(md, out);
printConfigurations(md, out);
printPublications(md, out);
printDependencies(md, out);
out.println("</ivy-module>");
}
}
示例4: printInfoTag
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private static void printInfoTag(ModuleDescriptor md, PrintWriter out) {
out.println("\t<info organisation=\""
+ XMLHelper.escape(md.getModuleRevisionId().getOrganisation()) + "\"");
out.println("\t\tmodule=\"" + XMLHelper.escape(md.getModuleRevisionId().getName()) + "\"");
String branch = md.getResolvedModuleRevisionId().getBranch();
if (branch != null) {
out.println("\t\tbranch=\"" + XMLHelper.escape(branch) + "\"");
}
String revision = md.getResolvedModuleRevisionId().getRevision();
if (revision != null) {
out.println("\t\trevision=\"" + XMLHelper.escape(revision) + "\"");
}
out.println("\t\tstatus=\"" + XMLHelper.escape(md.getStatus()) + "\"");
out.println("\t\tpublication=\"" + DateUtil.format(md.getResolvedPublicationDate()) + "\"");
if (md.isDefault()) {
out.println("\t\tdefault=\"true\"");
}
if (md instanceof DefaultModuleDescriptor) {
DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
if (dmd.getNamespace() != null && !dmd.getNamespace().getName().equals("system")) {
out.println("\t\tnamespace=\"" + XMLHelper.escape(dmd.getNamespace().getName())
+ "\"");
}
}
if (!md.getExtraAttributes().isEmpty()) {
printExtraAttributes(md, out, "\t\t");
out.println();
}
if (requireInnerInfoElement(md)) {
out.println("\t>");
for (ExtendsDescriptor parent : md.getInheritedDescriptors()) {
ModuleRevisionId mrid = parent.getParentRevisionId();
out.print(String.format("\t\t<extends organisation=\"%s\" module=\"%s\" revision=\"%s\"",
XMLHelper.escape(mrid.getOrganisation()),
XMLHelper.escape(mrid.getName()),
XMLHelper.escape(mrid.getRevision())));
String location = parent.getLocation();
if (location != null) {
out.print(" location=\"" + XMLHelper.escape(location) + "\"");
}
out.print(" extendType=\"" + joinArray(parent.getExtendsTypes(), ",") + "\"");
out.println("/>");
}
License[] licenses = md.getLicenses();
for (License license : licenses) {
out.print("\t\t<license ");
if (license.getName() != null) {
out.print("name=\"" + XMLHelper.escape(license.getName()) + "\" ");
}
if (license.getUrl() != null) {
out.print("url=\"" + XMLHelper.escape(license.getUrl()) + "\" ");
}
out.println("/>");
}
if (md.getHomePage() != null || md.getDescription() != null) {
out.print("\t\t<description");
if (md.getHomePage() != null) {
out.print(" homepage=\"" + XMLHelper.escape(md.getHomePage()) + "\"");
}
if (isNullOrEmpty(md.getDescription())) {
out.println(" />");
} else {
out.println(">");
out.println("\t\t" + XMLHelper.escape(md.getDescription()));
out.println("\t\t</description>");
}
}
for (ExtraInfoHolder extraInfo : md.getExtraInfos()) {
printExtraInfoElement(out, extraInfo, 2);
}
out.println("\t</info>");
} else {
out.println("\t/>");
}
}
示例5: requireInnerInfoElement
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private static boolean requireInnerInfoElement(ModuleDescriptor md) {
return md.getExtraInfos().size() > 0 || md.getHomePage() != null
|| !isNullOrEmpty(md.getDescription())
|| md.getLicenses().length > 0 || md.getInheritedDescriptors().length > 0;
}
示例6: startExtends
import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private void startExtends(Attributes attributes) {
// in merge mode, comment out extends element
if (options.isMerge()) {
write("<!-- ");
}
write("<extends");
String org = substitute(settings, attributes.getValue("organisation"));
String module = substitute(settings, attributes.getValue("module"));
ModuleId parentId = new ModuleId(org, module);
for (int i = 0; i < attributes.getLength(); i++) {
String name = attributes.getQName(i);
String value = null;
switch (name) {
case "organisation":
value = org;
break;
case "module":
value = module;
break;
case "revision":
// replace inline revision with resolved parent revision
ModuleDescriptor merged = options.getMergedDescriptor();
if (merged != null) {
for (ExtendsDescriptor parent : merged.getInheritedDescriptors()) {
ModuleRevisionId resolvedId = parent.getResolvedParentRevisionId();
if (parentId.equals(resolvedId.getModuleId())) {
value = resolvedId.getRevision();
if (value != null) {
break;
}
}
}
}
if (value == null) {
value = substitute(settings, attributes.getValue(i));
}
break;
default:
value = substitute(settings, attributes.getValue(i));
break;
}
write(" " + name + "=\"" + value + "\"");
}
}