Java Code Examples for org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId()
The following examples show how to use
org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId() .
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: DefaultResolutionCacheManager.java From ant-ivy with Apache License 2.0 | 6 votes |
public void saveResolvedModuleDescriptor(ModuleDescriptor md) throws ParseException, IOException { ModuleRevisionId mrevId = md.getResolvedModuleRevisionId(); File ivyFileInCache = getResolvedIvyFileInCache(mrevId); md.toIvyFile(ivyFileInCache); Properties paths = new Properties(); saveLocalParents(mrevId, md, ivyFileInCache, paths); if (!paths.isEmpty()) { File parentsFile = getResolvedIvyPropertiesInCache(ModuleRevisionId.newInstance(mrevId, mrevId.getRevision() + "-parents")); FileOutputStream out = new FileOutputStream(parentsFile); paths.store(out, null); out.close(); } }
Example 2
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Saves the information of which resolver was used to resolve a md, so that this info can be * retrieve later (even after a jvm restart) by getSavedArtResolverName(ModuleDescriptor md) * * @param md * the module descriptor resolved * @param metadataResolverName * metadata resolver name * @param artifactResolverName * artifact resolver name */ public void saveResolvers(ModuleDescriptor md, String metadataResolverName, String artifactResolverName) { ModuleRevisionId mrid = md.getResolvedModuleRevisionId(); if (!lockMetadataArtifact(mrid)) { Message.error("impossible to acquire lock for " + mrid); return; } try { PropertiesFile cdf = getCachedDataFile(md); cdf.setProperty("resolver", metadataResolverName); cdf.setProperty("artifact.resolver", artifactResolverName); cdf.save(); } finally { unlockMetadataArtifact(mrid); } }
Example 3
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
private void resolveAndCheckRevision(ModuleDescriptor systemMd, ModuleRevisionId dependencyConstraint, ResolvedResource ivyRef, boolean isDynamic) { // we get the resolved module revision id from the descriptor: it may contain extra // attributes that were not included in the dependency constraint ModuleRevisionId resolvedMrid = systemMd.getResolvedModuleRevisionId(); if (resolvedMrid.getRevision() == null || resolvedMrid.getRevision().length() == 0 || resolvedMrid.getRevision().startsWith("working@")) { if (!isDynamic) { resolvedMrid = ModuleRevisionId.newInstance(resolvedMrid, dependencyConstraint.getRevision()); } else if (ivyRef == null) { resolvedMrid = systemMd.getMetadataArtifact().getModuleRevisionId(); } else if (ivyRef.getRevision() == null || ivyRef.getRevision().length() == 0) { resolvedMrid = ModuleRevisionId.newInstance(resolvedMrid, "working@" + getName()); } else { resolvedMrid = ModuleRevisionId.newInstance(resolvedMrid, ivyRef.getRevision()); } } if (isDynamic) { Message.verbose("\t\t[" + toSystem(resolvedMrid).getRevision() + "] " + dependencyConstraint.getModuleId()); } systemMd.setResolvedModuleRevisionId(resolvedMrid); checkModuleDescriptorRevision(systemMd, dependencyConstraint); }
Example 4
Source File: RepositoryManagementEngine.java From ant-ivy with Apache License 2.0 | 5 votes |
private ModuleRevisionId getDependency(DependencyDescriptor dd) { ModuleRevisionId askedMrid = dd.getDependencyRevisionId(); VersionMatcher vmatcher = settings.getVersionMatcher(); if (vmatcher.isDynamic(askedMrid)) { ModuleRevisionId mrid = cache.get(askedMrid); if (mrid == null) { for (ModuleDescriptor md : getAllRevisions(askedMrid)) { if (vmatcher.needModuleDescriptor(askedMrid, md.getResolvedModuleRevisionId())) { if (vmatcher.accept(askedMrid, md)) { mrid = md.getResolvedModuleRevisionId(); break; } } else { if (vmatcher.accept(askedMrid, md.getResolvedModuleRevisionId())) { mrid = md.getResolvedModuleRevisionId(); break; } } } if (mrid == null) { return null; } else { cache.put(askedMrid, mrid); } } return mrid; } else { return askedMrid; } }