本文整理汇总了Java中org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.addDependency方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultModuleDescriptor.addDependency方法的具体用法?Java DefaultModuleDescriptor.addDependency怎么用?Java DefaultModuleDescriptor.addDependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor
的用法示例。
在下文中一共展示了DefaultModuleDescriptor.addDependency方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeModuleDescriptor
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public static DefaultModuleDescriptor computeModuleDescriptor(DefaultModuleDescriptor md, IvySettings settings,
List<IvyDependency> dependencies, List<IvyConflict> conflicts, List<IvyExclude> excludes) {
for (IvyDependency dependency : dependencies) {
DependencyDescriptor dd = dependency.asDependencyDescriptor(md, "default", settings);
md.addDependency(dd);
}
for (IvyExclude exclude : excludes) {
org.apache.ivy.core.module.descriptor.DefaultExcludeRule rule = exclude.asRule(settings);
rule.addConfiguration("default");
md.addExcludeRule(rule);
}
for (IvyConflict conflict : conflicts) {
conflict.addConflict(md, settings);
}
return md;
}
示例2: mergeDependencies
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private void mergeDependencies(DependencyDescriptor[] dependencies) {
DefaultModuleDescriptor md = getMd();
for (DependencyDescriptor dependencyDescriptor : dependencies) {
LOGGER.debug("Merging dependency with: {}", dependencyDescriptor.getDependencyRevisionId());
md.addDependency(dependencyDescriptor);
}
}
示例3: buildResolvedCapabilityMd
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private MDResolvedResource buildResolvedCapabilityMd(DependencyDescriptor dd,
ModuleDescriptor md) {
String org = dd.getDependencyRevisionId().getOrganisation();
String name = dd.getDependencyRevisionId().getName();
String rev = md.getExtraInfoContentByTagName(BundleInfoAdapter.EXTRA_INFO_EXPORT_PREFIX
+ name);
ModuleRevisionId capabilityRev = ModuleRevisionId.newInstance(org, name, rev,
Collections.singletonMap(CAPABILITY_EXTRA_ATTR, md.getModuleRevisionId().toString()));
DefaultModuleDescriptor capabilityMd = new DefaultModuleDescriptor(capabilityRev,
getSettings().getStatusManager().getDefaultStatus(), new Date());
String useConf = BundleInfoAdapter.CONF_USE_PREFIX + dd.getDependencyRevisionId().getName();
capabilityMd.addConfiguration(BundleInfoAdapter.CONF_DEFAULT);
capabilityMd.addConfiguration(BundleInfoAdapter.CONF_OPTIONAL);
capabilityMd.addConfiguration(BundleInfoAdapter.CONF_TRANSITIVE_OPTIONAL);
capabilityMd.addConfiguration(new Configuration(useConf));
DefaultDependencyDescriptor capabilityDD = new DefaultDependencyDescriptor(
md.getModuleRevisionId(), false);
capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_DEFAULT,
BundleInfoAdapter.CONF_NAME_DEFAULT);
capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_OPTIONAL,
BundleInfoAdapter.CONF_NAME_OPTIONAL);
capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL,
BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL);
capabilityDD.addDependencyConfiguration(useConf, useConf);
capabilityMd.addDependency(capabilityDD);
MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null);
report.setDownloadStatus(DownloadStatus.NO);
report.setSearched(true);
ResolvedModuleRevision rmr = new ResolvedModuleRevision(this, this, capabilityMd, report);
return new MDResolvedResource(null, capabilityMd.getRevision(), rmr);
}
示例4: requirementAsDependency
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private static void requirementAsDependency(DefaultModuleDescriptor md, BundleInfo bundleInfo,
Set<String> exportedPkgNames) {
for (BundleRequirement requirement : bundleInfo.getRequirements()) {
String type = requirement.getType();
String name = requirement.getName();
if (BundleInfo.PACKAGE_TYPE.equals(type) && exportedPkgNames.contains(name)) {
// don't declare package exported by the current bundle
continue;
}
if (BundleInfo.EXECUTION_ENVIRONMENT_TYPE.equals(type)) {
// execution environment are handled elsewhere
continue;
}
ModuleRevisionId ddmrid = asMrid(type, name, requirement.getVersion());
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ddmrid, false);
String conf = CONF_NAME_DEFAULT;
if (BundleInfo.PACKAGE_TYPE.equals(type)) {
// declare the configuration for the package
conf = CONF_USE_PREFIX + name;
md.addConfiguration(new Configuration(CONF_USE_PREFIX + name, PUBLIC,
"Exported package " + name, new String[] {CONF_NAME_DEFAULT}, true, null));
dd.addDependencyConfiguration(conf, conf);
}
if ("optional".equals(requirement.getResolution())) {
dd.addDependencyConfiguration(CONF_NAME_OPTIONAL, conf);
dd.addDependencyConfiguration(CONF_NAME_TRANSITIVE_OPTIONAL,
CONF_NAME_TRANSITIVE_OPTIONAL);
} else {
dd.addDependencyConfiguration(CONF_NAME_DEFAULT, conf);
}
md.addDependency(dd);
}
}
示例5: mergeDependencies
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
/**
* Describes how dependencies should be inherited
*
* @param dependencies
* array of dependencies to inherit
*/
protected void mergeDependencies(DependencyDescriptor[] dependencies) {
DefaultModuleDescriptor md = getMd();
for (DependencyDescriptor dependencyDescriptor : dependencies) {
Message.debug("Merging dependency with: "
+ dependencyDescriptor.getDependencyRevisionId().toString());
md.addDependency(dependencyDescriptor);
}
}
示例6: addDependency
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private DependencyDescriptor addDependency(DefaultModuleDescriptor parent, String moduleName,
String revision) {
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org", moduleName, revision);
DependencyDescriptor depDescr = new DefaultDependencyDescriptor(parent, mrid, false, false,
true);
parent.addDependency(depDescr);
return depDescr;
}
示例7: cloneMd
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private DefaultModuleDescriptor cloneMd(ModuleDescriptor md, Artifact af) {
DefaultModuleDescriptor newMd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
"release", null, true);
newMd.addConfiguration(new Configuration(ModuleDescriptor.DEFAULT_CONFIGURATION));
newMd.setLastModified(System.currentTimeMillis());
newMd.setDescription(md.getDescription());
newMd.setHomePage(md.getHomePage());
newMd.setLastModified(md.getLastModified());
newMd.setPublicationDate(md.getPublicationDate());
newMd.setResolvedPublicationDate(md.getResolvedPublicationDate());
newMd.setStatus(md.getStatus());
Configuration[] allConfs = md.getConfigurations();
if (allConfs.length == 0) {
newMd.addArtifact(ModuleDescriptor.DEFAULT_CONFIGURATION, af);
} else {
for (Configuration conf : allConfs) {
newMd.addConfiguration(conf);
newMd.addArtifact(conf.getName(), af);
}
}
for (DependencyDescriptor dependency : md.getDependencies()) {
newMd.addDependency(dependency);
}
for (ExcludeRule excludeRule : md.getAllExcludeRules()) {
newMd.addExcludeRule(excludeRule);
}
newMd.getExtraInfos().addAll(md.getExtraInfos());
for (License license : md.getLicenses()) {
newMd.addLicense(license);
}
return newMd;
}
示例8: addDependencyDescriptor
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void addDependencyDescriptor(String configuration, DefaultModuleDescriptor moduleDescriptor,
ModuleDependency dependency) {
IvyDependencyDescriptorFactory factoryInternal = findFactoryForDependency(dependency);
EnhancedDependencyDescriptor dependencyDescriptor = factoryInternal.createDependencyDescriptor(configuration, dependency, moduleDescriptor);
moduleDescriptor.addDependency(dependencyDescriptor);
}
示例9: doExecute
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
prepareAndCheck();
ModuleDescriptor originalModuleDescriptor = getResolvedReport().getModuleDescriptor();
// clone module descriptor
DefaultModuleDescriptor latestModuleDescriptor = new DefaultModuleDescriptor(
originalModuleDescriptor.getModuleRevisionId(),
originalModuleDescriptor.getStatus(), originalModuleDescriptor.getPublicationDate());
// copy configurations
for (Configuration configuration : originalModuleDescriptor.getConfigurations()) {
latestModuleDescriptor.addConfiguration(configuration);
}
// clone dependency and add new one with the requested revisionToCheck
for (DependencyDescriptor dependencyDescriptor : originalModuleDescriptor.getDependencies()) {
ModuleRevisionId upToDateMrid = ModuleRevisionId.newInstance(
dependencyDescriptor.getDependencyRevisionId(), revisionToCheck);
latestModuleDescriptor.addDependency(dependencyDescriptor.clone(upToDateMrid));
}
// resolve
ResolveOptions resolveOptions = new ResolveOptions();
resolveOptions.setDownload(isDownload());
resolveOptions.setLog(getLog());
resolveOptions.setConfs(splitToArray(getConf()));
resolveOptions.setCheckIfChanged(checkIfChanged);
ResolveReport latestReport;
try {
latestReport = getIvyInstance().getResolveEngine().resolve(latestModuleDescriptor,
resolveOptions);
displayDependencyUpdates(getResolvedReport(), latestReport);
if (showTransitive) {
displayNewDependencyOnLatest(getResolvedReport(), latestReport);
displayMissingDependencyOnLatest(getResolvedReport(), latestReport);
}
} catch (ParseException | IOException e) {
throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
}
}
示例10: generateModules
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private void generateModules(int nbModules, int minDependencies, int maxDependencies,
int minVersions, int maxVersions) throws IOException {
int nb = 0;
int curDep = 1;
int varDeps = maxDependencies - minDependencies;
int varVersions = maxVersions - minVersions;
Random r = new Random(System.currentTimeMillis());
while (nb < nbModules) {
int deps = minDependencies + r.nextInt(varDeps + 1);
int versions = minVersions + r.nextInt(varVersions + 1);
int prevCurDep = curDep;
for (int ver = 0; ver < versions; ver++) {
DefaultModuleDescriptor md = new DefaultModuleDescriptor(
ModuleRevisionId.newInstance("apache", "mod" + nb, "1." + ver),
"integration", new Date());
curDep = prevCurDep;
for (int i = 0; i < deps && curDep < nbModules; i++) {
int d;
if (i % 2 == 1) {
d = nb + i;
if (d >= prevCurDep) {
d = curDep;
curDep++;
}
} else {
d = curDep;
curDep++;
}
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
md,
ModuleRevisionId.newInstance("apache", "mod" + d, "latest.integration"),
false, false, true);
dd.addDependencyConfiguration("default", "default");
md.addDependency(dd);
}
XmlModuleDescriptorWriter.write(md, new File("build/test/perf/mod" + nb + "/ivy-1."
+ ver + ".xml"));
FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
new File("build/test/perf/mod" + nb + "/mod" + nb + "-1." + ver + ".jar"), null);
}
nb++;
}
}