本文整理汇总了Java中org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.newCallerInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultModuleDescriptor.newCallerInstance方法的具体用法?Java DefaultModuleDescriptor.newCallerInstance怎么用?Java DefaultModuleDescriptor.newCallerInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor
的用法示例。
在下文中一共展示了DefaultModuleDescriptor.newCallerInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findModule
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public ResolvedModuleRevision findModule(ModuleRevisionId id, ResolveOptions options) {
DependencyResolver r = settings.getResolver(id);
if (r == null) {
throw new IllegalStateException("no resolver found for " + id.getModuleId());
}
DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(id,
new String[] {"*"}, false, false);
if (options.getResolveId() == null) {
options.setResolveId(ResolveOptions.getDefaultResolveId(md));
}
try {
return r.getDependency(new DefaultDependencyDescriptor(id, true), new ResolveData(this,
options, new ConfigurationResolveReport(this, md, "default", null, options)));
} catch (ParseException e) {
throw new RuntimeException("problem while parsing repository module descriptor for "
+ id + ": " + e, e);
}
}
示例2: resolve
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
/**
* Resolves the module identified by the given mrid with its dependencies if transitive is set
* to true.
*
* @param mrid ModuleRevisionId
* @param options ResolveOptions
* @param changing boolean
* @return ResolveReport
* @throws ParseException if something goes wrong
* @throws IOException if something goes wrong
*/
public ResolveReport resolve(final ModuleRevisionId mrid, ResolveOptions options,
boolean changing) throws ParseException, IOException {
DefaultModuleDescriptor md;
ResolveOptions optionsToUse = new ResolveOptions(options);
if (options.useSpecialConfs()) {
// create new resolve options because this is a different resolve than the real resolve
// (which will be a resolve of a newCallerInstance module)
ResolvedModuleRevision rmr = findModule(mrid, new ResolveOptions(options));
if (rmr == null) {
Message.verbose("module not found " + mrid);
// we will continue the resolve anyway to get a nice error message back
// to the user, however reduce the amount of logging in this case
optionsToUse.setLog(LogOptions.LOG_DOWNLOAD_ONLY);
md = DefaultModuleDescriptor.newCallerInstance(mrid, new String[] {"default"},
options.isTransitive(), changing);
} else {
String[] confs = options.getConfs(rmr.getDescriptor());
md = DefaultModuleDescriptor.newCallerInstance(
ModuleRevisionId.newInstance(mrid, rmr.getId().getRevision()), confs,
options.isTransitive(), changing);
}
} else {
md = DefaultModuleDescriptor.newCallerInstance(mrid, options.getConfs(),
options.isTransitive(), changing);
}
return resolve(md, optionsToUse);
}
示例3: doExecute
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
if (xsl && xslFile == null) {
throw new BuildException("xsl file is mandatory when using xsl generation");
}
if (module == null && PatternMatcher.EXACT.equals(matcher)) {
throw new BuildException("no module name provided for ivy repository graph task: "
+ "It can either be set explicitly via the attribute 'module' or "
+ "via 'ivy.module' property or a prior call to <resolve/>");
} else if (module == null && !PatternMatcher.EXACT.equals(matcher)) {
module = PatternMatcher.ANY_EXPRESSION;
}
ModuleRevisionId moduleRevisionId = ModuleRevisionId.newInstance(organisation, module, revision);
try {
ModuleRevisionId criteria = (revision == null) || settings.getVersionMatcher().isDynamic(moduleRevisionId)
? new ModuleRevisionId(new ModuleId(organisation, module), branch, "*")
: new ModuleRevisionId(new ModuleId(organisation, module), branch, revision);
ModuleRevisionId[] mrids = ivy.listModules(criteria, settings.getMatcher(matcher));
// replace all found revisions with the original requested revision
Set<ModuleRevisionId> modules = new HashSet<>();
for (ModuleRevisionId mrid : mrids) {
modules.add(ModuleRevisionId.newInstance(mrid, revision));
}
mrids = modules.toArray(new ModuleRevisionId[modules.size()]);
ModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true, false);
String resolveId = ResolveOptions.getDefaultResolveId(md);
ResolveReport report = ivy.resolve(md, new ResolveOptions().setResolveId(resolveId)
.setValidate(doValidate(settings)));
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
new XmlReportOutputter().output(report, cacheMgr, new ResolveOptions());
if (graph) {
gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(),
md.getModuleRevisionId().getName());
}
if (dot) {
gendot(cacheMgr, md.getModuleRevisionId().getOrganisation(),
md.getModuleRevisionId().getName());
}
if (xml) {
FileUtil.copy(cacheMgr.getConfigurationResolveReportInCache(resolveId, "default"),
new File(getTodir(), outputname + ".xml"), null);
}
if (xsl) {
genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(),
md.getModuleRevisionId().getName());
}
} catch (Exception e) {
throw new BuildException("impossible to generate graph for " + moduleRevisionId + ": " + e, e);
}
}