Java Code Examples for org.apache.ivy.core.module.descriptor.ModuleDescriptor#getRevision()
The following examples show how to use
org.apache.ivy.core.module.descriptor.ModuleDescriptor#getRevision() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOSGiResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
public ResolvedResource[] findBundle(DependencyDescriptor dd, ResolveData data, Collection<ModuleDescriptor> mds) { ResolvedResource[] ret = new ResolvedResource[mds.size()]; int i = 0; for (ModuleDescriptor md : mds) { MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null); report.setDownloadStatus(DownloadStatus.NO); report.setSearched(true); ResolvedModuleRevision rmr = new ResolvedModuleRevision(this, this, md, report); MDResolvedResource mdrr = new MDResolvedResource(null, md.getRevision(), rmr); ret[i++] = mdrr; } return ret; }
Example 2
Source File: RepositoryResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
@Override protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern, Artifact artifact, ResourceMDParser rmdparser, Date date) { String name = getName(); VersionMatcher versionMatcher = getSettings().getVersionMatcher(); try { if (!versionMatcher.isDynamic(mrid) || isAlwaysCheckExactRevision()) { String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact); Message.debug("\t trying " + resourceName); logAttempt(resourceName); Resource res = repository.getResource(resourceName); boolean reachable = res.exists(); if (reachable) { String revision; if (pattern.contains(IvyPatternHelper.REVISION_KEY)) { revision = mrid.getRevision(); } else { if ("ivy".equals(artifact.getType()) || "pom".equals(artifact.getType())) { // we can't determine the revision from the pattern, get it // from the module descriptor itself File temp = File.createTempFile("ivy", artifact.getExt()); temp.deleteOnExit(); repository.get(res.getName(), temp); ModuleDescriptorParser parser = ModuleDescriptorParserRegistry .getInstance().getParser(res); ModuleDescriptor md = parser.parseDescriptor(getParserSettings(), temp .toURI().toURL(), res, false); revision = md.getRevision(); if (isNullOrEmpty(revision)) { revision = "working@" + name; } } else { revision = "working@" + name; } } return new ResolvedResource(res, revision); } else if (versionMatcher.isDynamic(mrid)) { return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date); } else { Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res=" + res); return null; } } else { return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date); } } catch (IOException | ParseException ex) { throw new RuntimeException(name + ": unable to get resource for " + mrid + ": res=" + IvyPatternHelper.substitute(pattern, mrid, artifact) + ": " + ex, ex); } }