org.apache.ivy.core.module.id.ModuleId Java Examples
The following examples show how to use
org.apache.ivy.core.module.id.ModuleId.
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: PomReader.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public List<ModuleId> getExcludedModules() { Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS); List<ModuleId> exclusions = new LinkedList<ModuleId>(); if (exclusionsElement != null) { NodeList childs = exclusionsElement.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node node = childs.item(i); if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) { String groupId = getFirstChildText((Element) node, GROUP_ID); String artifactId = getFirstChildText((Element) node, ARTIFACT_ID); if ((groupId != null) && (artifactId != null)) { exclusions.add(IvyUtil.createModuleId(groupId, artifactId)); } } } } return exclusions; }
Example #2
Source File: ModuleVersionSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private ExcludeRuleBackedSpec(Iterable<ExcludeRule> excludeRules) { for (ExcludeRule rule : excludeRules) { if (!(rule.getMatcher() instanceof ExactPatternMatcher)) { excludeSpecs.add(new ExcludeRuleSpec(rule)); continue; } ModuleId moduleId = rule.getId().getModuleId(); boolean wildcardGroup = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getOrganisation()); boolean wildcardModule = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getName()); if (wildcardGroup && wildcardModule) { excludeSpecs.add(new ExcludeRuleSpec(rule)); } else if (wildcardGroup) { excludeSpecs.add(new ModuleNameSpec(moduleId.getName())); } else if (wildcardModule) { excludeSpecs.add(new GroupNameSpec(moduleId.getOrganisation())); } else { excludeSpecs.add(new ModuleIdSpec(moduleId)); } } }
Example #3
Source File: IvyNode.java From ant-ivy with Apache License 2.0 | 6 votes |
private Collection<IvyNode> findPath(ModuleId from, IvyNode node, List<IvyNode> path) { IvyNode parent = node.getDirectCallerFor(from); if (parent == null) { throw new IllegalArgumentException("no path from " + from + " to " + getId() + " found"); } if (path.contains(parent)) { path.add(0, parent); Message.verbose( "circular dependency found while looking for the path for another one: was looking for " + from + " as a caller of " + path.get(path.size() - 1)); return path; } path.add(0, parent); if (parent.getId().getModuleId().equals(from)) { return path; } return findPath(from, parent, path); }
Example #4
Source File: ModuleVersionSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private ExcludeRuleBackedSpec(Iterable<ExcludeRule> excludeRules) { for (ExcludeRule rule : excludeRules) { if (!(rule.getMatcher() instanceof ExactPatternMatcher)) { excludeSpecs.add(new ExcludeRuleSpec(rule)); continue; } ModuleId moduleId = rule.getId().getModuleId(); boolean wildcardGroup = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getOrganisation()); boolean wildcardModule = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getName()); if (wildcardGroup && wildcardModule) { excludeSpecs.add(new ExcludeRuleSpec(rule)); } else if (wildcardGroup) { excludeSpecs.add(new ModuleNameSpec(moduleId.getName())); } else if (wildcardModule) { excludeSpecs.add(new GroupNameSpec(moduleId.getOrganisation())); } else { excludeSpecs.add(new ModuleIdSpec(moduleId)); } } }
Example #5
Source File: PomReader.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public List<ModuleId> getExcludedModules() { Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS); List<ModuleId> exclusions = new LinkedList<ModuleId>(); if (exclusionsElement != null) { NodeList childs = exclusionsElement.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node node = childs.item(i); if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) { String groupId = getFirstChildText((Element) node, GROUP_ID); String artifactId = getFirstChildText((Element) node, ARTIFACT_ID); if ((groupId != null) && (artifactId != null)) { exclusions.add(IvyUtil.createModuleId(groupId, artifactId)); } } } } return exclusions; }
Example #6
Source File: XmlModuleDescriptorParser.java From ant-ivy with Apache License 2.0 | 6 votes |
protected void mediationOverrideStarted(Attributes attributes) { String org = settings.substitute(attributes.getValue("org")); if (org == null) { org = PatternMatcher.ANY_EXPRESSION; } String mod = settings.substitute(attributes.getValue("module")); if (mod == null) { mod = PatternMatcher.ANY_EXPRESSION; } String rev = settings.substitute(attributes.getValue("rev")); String branch = settings.substitute(attributes.getValue("branch")); String matcherName = settings.substitute(attributes.getValue("matcher")); PatternMatcher matcher = (matcherName == null) ? defaultMatcher : settings.getMatcher(matcherName); if (matcher == null) { addError("unknown matcher: " + matcherName); return; } getMd().addDependencyDescriptorMediator(new ModuleId(org, mod), matcher, new OverrideDependencyDescriptorMediator(branch, rev)); }
Example #7
Source File: MessageBasedNonMatchingVersionReporter.java From ant-ivy with Apache License 2.0 | 6 votes |
public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md) { ModuleRevisionId dependencyRevisionId = descriptor.getDependencyRevisionId(); ModuleRevisionId parentRevisionId = descriptor.getParentRevisionId(); if (parentRevisionId == null) { // There are some rare case where DependencyDescriptor have no parent. // This is should not be used in the SortEngine, but if it is, we // show a decent trace. reportMessage("Non matching revision detected when sorting. Dependency " + dependencyRevisionId + " doesn't match " + md.getModuleRevisionId()); } else { ModuleId parentModuleId = parentRevisionId.getModuleId(); reportMessage("Non matching revision detected when sorting. " + parentModuleId + " depends on " + dependencyRevisionId + ", doesn't match " + md.getModuleRevisionId()); } }
Example #8
Source File: IvyNodeElementAdapter.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Derives configuration conflicts that exist between node and all of its descendant dependencies. */ private static void findConflictsBeneathNode(IvyNodeElement node) { // Derive conflicts Map<ModuleId,Collection<IvyNodeElement>> moduleRevisionMap = new HashMap<>(); IvyNodeElement[] deepDependencies = node.getDeepDependencies(); for (int i = 0; i < deepDependencies.length; i++) { if (deepDependencies[i].isEvicted()) continue; ModuleId moduleId = deepDependencies[i].getModuleRevisionId().getModuleId(); if (moduleRevisionMap.containsKey(moduleId)) { Collection<IvyNodeElement> conflicts = moduleRevisionMap.get(moduleId); conflicts.add(deepDependencies[i]); for (Iterator<IvyNodeElement> iter = conflicts.iterator(); iter.hasNext();) { IvyNodeElement conflict = iter.next(); conflict.setConflicts(conflicts); } } else { List<IvyNodeElement> immutableMatchingSet = Arrays.asList(deepDependencies[i]); moduleRevisionMap.put(moduleId, new HashSet<>(immutableMatchingSet)); } } }
Example #9
Source File: IvyFindRevision.java From ant-ivy with Apache License 2.0 | 6 votes |
public void doExecute() throws BuildException { if (organisation == null) { throw new BuildException("no organisation provided for ivy findrevision task"); } if (module == null) { throw new BuildException("no module name provided for ivy findrevision task"); } if (revision == null) { throw new BuildException("no revision provided for ivy findrevision task"); } Ivy ivy = getIvyInstance(); IvySettings settings = ivy.getSettings(); if (branch == null) { branch = settings.getDefaultBranch(new ModuleId(organisation, module)); } ResolvedModuleRevision rmr = ivy.findModule(ModuleRevisionId.newInstance(organisation, module, branch, revision)); if (rmr != null) { getProject().setProperty(property, rmr.getId().getRevision()); } }
Example #10
Source File: PomReader.java From ant-ivy with Apache License 2.0 | 6 votes |
public List<ModuleId> getExcludedModules() { Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS); if (exclusionsElement == null) { return Collections.emptyList(); } List<ModuleId> exclusions = new LinkedList<>(); NodeList children = exclusionsElement.getChildNodes(); for (int i = 0, sz = children.getLength(); i < sz; i++) { Node node = children.item(i); if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) { String groupId = getFirstChildText((Element) node, GROUP_ID); String artifactId = getFirstChildText((Element) node, ARTIFACT_ID); if (groupId != null && artifactId != null) { exclusions.add(ModuleId.newInstance(groupId, artifactId)); } } } return exclusions; }
Example #11
Source File: ModuleVersionSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(ModuleId element) { for (ModuleVersionSpec spec : specs) { if (!spec.isSatisfiedBy(element)) { return false; } } return true; }
Example #12
Source File: PomModuleDescriptorBuilder.java From ant-ivy with Apache License 2.0 | 5 votes |
private String getDefaultVersion(PomDependencyData dep) { ModuleId moduleId = ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId()); if (ivyModuleDescriptor.getDependencyManagementMap().containsKey(moduleId)) { return ivyModuleDescriptor.getDependencyManagementMap().get(moduleId).getVersion(); } String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(), dep.getArtifactId()); return ivyModuleDescriptor.getExtraInfoContentByTagName(key); }
Example #13
Source File: IvyRepositoryReport.java From ant-ivy with Apache License 2.0 | 5 votes |
private void gen(ResolutionCacheManager cache, String organisation, String module, String style, String ext) { XSLTProcess xslt = new XSLTProcess(); xslt.setTaskName(getTaskName()); xslt.setProject(getProject()); xslt.init(); String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module)); xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default")); xslt.setOut(new File(getTodir(), outputname + "." + ext)); xslt.setBasedir(cache.getResolutionCacheRoot()); xslt.setStyle(style); xslt.execute(); }
Example #14
Source File: PomModuleDescriptorBuilder.java From ant-ivy with Apache License 2.0 | 5 votes |
public void addDependencyMgt(PomDependencyMgt dep) { ivyModuleDescriptor.addDependencyManagement(dep); String key = getDependencyMgtExtraInfoKeyForVersion(dep.getGroupId(), dep.getArtifactId()); overwriteExtraInfoIfExists(key, dep.getVersion()); if (dep.getScope() != null) { String scopeKey = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(), dep.getArtifactId()); overwriteExtraInfoIfExists(scopeKey, dep.getScope()); } if (!dep.getExcludedModules().isEmpty()) { String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(dep.getGroupId(), dep.getArtifactId()); int index = 0; for (ModuleId excludedModule : dep.getExcludedModules()) { overwriteExtraInfoIfExists( exclusionPrefix + index, excludedModule.getOrganisation() + EXTRA_INFO_DELIMITER + excludedModule.getName()); index++; } } // dependency management info is also used for version mediation of transitive dependencies ivyModuleDescriptor.addDependencyDescriptorMediator( ModuleId.newInstance(dep.getGroupId(), dep.getArtifactId()), ExactPatternMatcher.INSTANCE, new OverrideDependencyDescriptorMediator(null, dep.getVersion())); }
Example #15
Source File: IvyNodeEviction.java From ant-ivy with Apache License 2.0 | 5 votes |
public Collection<IvyNode> getEvictedNodes(ModuleId mid, String rootModuleConf) { Collection<IvyNode> resolved = evictedDeps.get(new ModuleIdConf(mid, rootModuleConf)); Set<IvyNode> ret = new HashSet<>(); if (resolved != null) { for (IvyNode node : resolved) { ret.add(node.getRealNode()); } } return ret; }
Example #16
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
protected ResourceMDParser getDefaultRMDParser(final ModuleId mid) { return new ResourceMDParser() { public MDResolvedResource parse(Resource resource, String rev) { DefaultModuleDescriptor md = DefaultModuleDescriptor .newDefaultInstance(new ModuleRevisionId(mid, rev)); MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport( md.getMetadataArtifact()); madr.setDownloadStatus(DownloadStatus.NO); madr.setSearched(true); return new MDResolvedResource(resource, rev, new ResolvedModuleRevision( BasicResolver.this, BasicResolver.this, md, madr, isForce())); } }; }
Example #17
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 5 votes |
public synchronized String getResolveMode(ModuleId moduleId) { ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() { public boolean accept(ModuleSettings o) { return o.getResolveMode() != null; } }); return ms == null ? getDefaultResolveMode() : ms.getResolveMode(); }
Example #18
Source File: Ivy14.java From ant-ivy with Apache License 2.0 | 5 votes |
public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern) { try { return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), new RetrieveOptions().setConfs(confs).setDestArtifactPattern(destFilePattern) .setDestIvyPattern(destIvyPattern)).getNbrArtifactsCopied(); } catch (IOException e) { throw new RuntimeException(e); } }
Example #19
Source File: Ivy14.java From ant-ivy with Apache License 2.0 | 5 votes |
public Map<ArtifactDownloadReport, Set<String>> determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern) throws ParseException, IOException { return ivy.getRetrieveEngine().determineArtifactsToCopy( new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), destFilePattern, new RetrieveOptions().setConfs(confs).setDestIvyPattern(destIvyPattern)); }
Example #20
Source File: ResolveReportTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testFixedMdTransitiveKeep() throws Exception { ResolveReport report = ivy.resolve(new File( "test/repositories/1/org2/mod2.9/ivys/ivy-0.6.xml"), getResolveOptions(new String[] {"*"})); assertNotNull(report); assertFalse(report.hasError()); ModuleDescriptor fixedMd = report.toFixedModuleDescriptor(ivy.getSettings(), Collections.singletonList(ModuleId.newInstance("org1", "mod1.2"))); ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.9", "0.6"); assertEquals(mrid, fixedMd.getModuleRevisionId()); assertEquals(Arrays.asList("default", "compile"), Arrays.asList(fixedMd.getConfigurationsNames())); assertEquals(2, fixedMd.getDependencies().length); checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.4", "1.0.2", "default", new String[] {"*"}); checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.4", "1.0.2", "compile", new String[] {"default", "compile"}); checkFixedMdDependency(fixedMd.getDependencies()[1], "org1", "mod1.2", "[1.0,2.0[", "default", new String[] {"*"}); checkFixedMdDependency(fixedMd.getDependencies()[1], "org1", "mod1.2", "[1.0,2.0[", "compile", new String[] {"default"}); }
Example #21
Source File: Ivy14.java From ant-ivy with Apache License 2.0 | 5 votes |
public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern, Filter<Artifact> artifactFilter, boolean sync, boolean useOrigin) { try { return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), new RetrieveOptions().setConfs(confs).setDestArtifactPattern(destFilePattern) .setDestIvyPattern(destIvyPattern) .setArtifactFilter(artifactFilter).setSync(sync) .setUseOrigin(useOrigin)).getNbrArtifactsCopied(); } catch (IOException e) { throw new RuntimeException(e); } }
Example #22
Source File: IvyNode.java From ant-ivy with Apache License 2.0 | 5 votes |
public ConflictManager getConflictManager(ModuleId mid) { if (md == null) { throw new IllegalStateException( "impossible to get conflict manager when data has not been loaded. IvyNode = " + this); } ConflictManager cm = md.getConflictManager(mid); return cm == null ? settings.getConflictManager(mid) : cm; }
Example #23
Source File: ModuleVersionSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(ModuleId element) { for (ModuleVersionSpec spec : specs) { if (spec.isSatisfiedBy(element)) { return true; } } return false; }
Example #24
Source File: ModuleVersionSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public boolean isSatisfiedBy(ModuleId element) { for (ModuleVersionSpec excludeSpec : excludeSpecs) { if (excludeSpec.isSatisfiedBy(element)) { return false; } } return true; }
Example #25
Source File: IvyBuildList.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Search in the moduleIdMap modules depending on node, add them to the toKeep set and process * them recursively. * * @param node * the node to be processed * @param toKeep * the set of ModuleDescriptors that should be kept * @param moduleIdMap * reference mapping of moduleId to ModuleDescriptor that are part of the BuildList */ private void processFilterNodeFromLeaf(ModuleDescriptor node, Set<ModuleDescriptor> toKeep, Map<ModuleId, ModuleDescriptor> moduleIdMap) { for (ModuleDescriptor md : moduleIdMap.values()) { for (DependencyDescriptor dep : md.getDependencies()) { if (node.getModuleRevisionId().getModuleId().equals(dep.getDependencyId()) && !toKeep.contains(md)) { toKeep.add(md); if (!getOnlydirectdep()) { processFilterNodeFromLeaf(md, toKeep, moduleIdMap); } } } } }
Example #26
Source File: GradlePomModuleDescriptorBuilder.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private List<ModuleId> getDependencyMgtExclusions(PomDependencyData dep) { PomDependencyMgt pomDependencyMgt = findDependencyDefault(dep); if (pomDependencyMgt != null) { return pomDependencyMgt.getExcludedModules(); } return Collections.emptyList(); }
Example #27
Source File: GradlePomModuleDescriptorBuilder.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void addDependency(DependencyDescriptor descriptor) { // Some POMs depend on themselves through their parent POM, don't add this dependency // since Ivy doesn't allow this! // Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom ModuleId dependencyId = descriptor.getDependencyId(); ModuleRevisionId mRevId = ivyModuleDescriptor.getModuleRevisionId(); if ((mRevId != null) && mRevId.getModuleId().equals(dependencyId)) { return; } ivyModuleDescriptor.addDependency(descriptor); }
Example #28
Source File: IvyConflict.java From ant-ivy with Apache License 2.0 | 5 votes |
void addConflict(DefaultModuleDescriptor md, IvySettings settings) { String matcherName = (matcher == null) ? PatternMatcher.EXACT : matcher; String orgPattern = (org == null) ? PatternMatcher.ANY_EXPRESSION : org; String modulePattern = (module == null) ? PatternMatcher.ANY_EXPRESSION : module; ConflictManager cm = null; if (rev != null) { cm = new FixedConflictManager(splitToArray(rev)); } else if (manager != null) { cm = settings.getConflictManager(manager); } md.addConflictManager(new ModuleId(orgPattern, modulePattern), settings.getMatcher(matcherName), cm); }
Example #29
Source File: Ivy14.java From ant-ivy with Apache License 2.0 | 5 votes |
public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern, Filter<Artifact> artifactFilter) { try { return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), new RetrieveOptions().setConfs(confs).setDestArtifactPattern(destFilePattern) .setDestIvyPattern(destIvyPattern) .setArtifactFilter(artifactFilter)).getNbrArtifactsCopied(); } catch (IOException e) { throw new RuntimeException(e); } }
Example #30
Source File: Ivy14.java From ant-ivy with Apache License 2.0 | 5 votes |
public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern) { try { return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), new RetrieveOptions().setConfs(confs) .setDestArtifactPattern(destFilePattern)).getNbrArtifactsCopied(); } catch (IOException e) { throw new RuntimeException(e); } }