org.apache.ivy.core.module.id.ModuleRevisionId Java Examples
The following examples show how to use
org.apache.ivy.core.module.id.ModuleRevisionId.
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: IvyXmlModuleDescriptorParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void mergeInfo(ModuleDescriptor parent) { ModuleRevisionId parentMrid = parent.getModuleRevisionId(); DefaultModuleDescriptor descriptor = getMd(); ModuleRevisionId currentMrid = descriptor.getModuleRevisionId(); ModuleRevisionId mergedMrid = createModuleRevisionId( mergeValue(parentMrid.getOrganisation(), currentMrid.getOrganisation()), currentMrid.getName(), mergeValue(parentMrid.getBranch(), currentMrid.getBranch()), mergeValue(parentMrid.getRevision(), currentMrid.getRevision()), mergeValues(parentMrid.getQualifiedExtraAttributes(), currentMrid.getQualifiedExtraAttributes()) ); descriptor.setModuleRevisionId(mergedMrid); descriptor.setResolvedModuleRevisionId(mergedMrid); descriptor.setStatus(mergeValue(parent.getStatus(), descriptor.getStatus())); if (descriptor.getNamespace() == null && parent instanceof DefaultModuleDescriptor) { Namespace parentNamespace = ((DefaultModuleDescriptor) parent).getNamespace(); descriptor.setNamespace(parentNamespace); } }
Example #2
Source File: LatestConflictManagerTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Test public void testLatestTime2() throws Exception { ivy = new Ivy(); ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time.xml")); ivy.getSettings().setVariable("ivy.log.conflict.resolution", "true", true); // set timestamps, because svn is not preserving this information, // and the latest time strategy is relying on it long time = System.currentTimeMillis() - 10000; new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").setLastModified(time); new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.2.jar") .setLastModified(time + 2000); ResolveReport report = ivy.resolve( LatestConflictManagerTest.class.getResource("ivy-latest-time-2.xml"), getResolveOptions()); ConfigurationResolveReport defaultReport = report.getConfigurationReport("default"); for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) { if (mrid.getName().equals("mod1.1")) { assertEquals("1.0", mrid.getRevision()); } else if (mrid.getName().equals("mod1.2")) { assertEquals("2.2", mrid.getRevision()); } } }
Example #3
Source File: ModuleInSort.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Check if a adding this element as a dependency of caller will introduce a circular * dependency. If it is, all the elements of the loop are flagged as 'loopIntermediateElement', * and the loopElements of this module (which is the root of the loop) is updated. The * depStrategy is invoked on order to report a correct circular loop message. * * @param futurCaller ModuleInSort * @param depStrategy CircularDependencyStrategy * @return true if a loop is detected. */ public boolean checkLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy) { if (caller != null) { List<ModuleRevisionId> elemOfLoop = new LinkedList<>(); elemOfLoop.add(this.module.getModuleRevisionId()); ModuleInSort stackEl = futurCaller; while (stackEl != this) { elemOfLoop.add(stackEl.module.getModuleRevisionId()); stackEl.isLoopIntermediateElement = true; loopElements.add(stackEl); stackEl = stackEl.caller; } elemOfLoop.add(this.module.getModuleRevisionId()); ModuleRevisionId[] mrids = elemOfLoop.toArray(new ModuleRevisionId[elemOfLoop.size()]); depStrategy.handleCircularDependency(mrids); return true; } else { return false; } }
Example #4
Source File: DefaultModuleDescriptor.java From ant-ivy with Apache License 2.0 | 6 votes |
public DefaultModuleDescriptor(ModuleRevisionId id, String status, Date pubDate, boolean isDefault) { if (id == null) { throw new NullPointerException("null module revision id not allowed"); } if (status == null) { throw new NullPointerException("null status not allowed"); } this.revId = id; this.resolvedRevId = id; this.status = status; this.publicationDate = pubDate; this.resolvedPublicationDate = publicationDate == null ? new Date() : publicationDate; this.isDefault = isDefault; this.parser = XmlModuleDescriptorParser.getInstance(); }
Example #5
Source File: ClientModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public EnhancedDependencyDescriptor createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); ClientModule clientModule = getClientModule(dependency); MutableModuleVersionMetaData moduleVersionMetaData = clientModuleMetaDataFactory.createModuleDescriptor( moduleRevisionId, clientModule.getDependencies()); EnhancedDependencyDescriptor dependencyDescriptor = new ClientModuleDependencyDescriptor( clientModule, parent, moduleVersionMetaData, moduleRevisionId, clientModule.isForce(), false, clientModule.isTransitive()); addExcludesArtifactsAndDependencies(configuration, clientModule, dependencyDescriptor); return dependencyDescriptor; }
Example #6
Source File: FileSystemResolverTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Test public void testLatestTime() throws Exception { FileSystemResolver resolver = new FileSystemResolver(); resolver.setName("test"); resolver.setSettings(settings); assertEquals("test", resolver.getName()); resolver.addIvyPattern(IVY_PATTERN); resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/1/" + "[organisation]/[module]/[type]s/[artifact]-[revision].[type]"); resolver.setLatestStrategy(new LatestTimeStrategy()); ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "2.0"); ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor( ModuleRevisionId.newInstance("org1", "mod1.1", "latest.integration"), false), data); assertNotNull(rmr); assertEquals(mrid, rmr.getId()); Date pubdate = new GregorianCalendar(2005, 1, 15, 11, 0, 0).getTime(); assertEquals(pubdate, rmr.getPublicationDate()); }
Example #7
Source File: ReflectiveDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public DependencyDescriptor create(DependencyDescriptor source, ModuleRevisionId targetId) { if (!(source instanceof DefaultDependencyDescriptor)) { throw new IllegalArgumentException("I can only create descriptors out of DefaultDependencyDescriptor"); } DefaultDependencyDescriptor out = new DefaultDependencyDescriptor(moduleDescriptor(source), targetId, source.getDynamicConstraintDependencyRevisionId(), source.isForce(), source.isChanging(), source.isTransitive()); setProperty(out, "parentId", getProperty(source, "parentId")); setProperty(out, "namespace", source.getNamespace()); ((Map) getProperty(out, "confs")).putAll((Map) getProperty(source, "confs")); Map sourceExcludeRules = (Map) getProperty(source, "excludeRules"); setProperty(out, "excludeRules", sourceExcludeRules == null? null: new LinkedHashMap(sourceExcludeRules)); Map sourceIncludeRules = (Map) getProperty(source, "includeRules"); setProperty(out, "includeRules", sourceIncludeRules == null ? null : new LinkedHashMap(sourceIncludeRules)); Map dependencyArtifacts = (Map) getProperty(source, "dependencyArtifacts"); setProperty(out, "dependencyArtifacts", dependencyArtifacts == null? null: new LinkedHashMap(dependencyArtifacts)); setProperty(out, "sourceModule", source.getSourceModule()); return out; }
Example #8
Source File: IvyXmlModuleDescriptorParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void mergeInfo(ModuleDescriptor parent) { ModuleRevisionId parentMrid = parent.getModuleRevisionId(); DefaultModuleDescriptor descriptor = getMd(); ModuleRevisionId currentMrid = descriptor.getModuleRevisionId(); ModuleRevisionId mergedMrid = createModuleRevisionId( mergeValue(parentMrid.getOrganisation(), currentMrid.getOrganisation()), currentMrid.getName(), mergeValue(parentMrid.getBranch(), currentMrid.getBranch()), mergeValue(parentMrid.getRevision(), currentMrid.getRevision()), mergeValues(parentMrid.getQualifiedExtraAttributes(), currentMrid.getQualifiedExtraAttributes()) ); descriptor.setModuleRevisionId(mergedMrid); descriptor.setResolvedModuleRevisionId(mergedMrid); descriptor.setStatus(mergeValue(parent.getStatus(), descriptor.getStatus())); if (descriptor.getNamespace() == null && parent instanceof DefaultModuleDescriptor) { Namespace parentNamespace = ((DefaultModuleDescriptor) parent).getNamespace(); descriptor.setNamespace(parentNamespace); } }
Example #9
Source File: IvyDependencyUpdateChecker.java From ant-ivy with Apache License 2.0 | 6 votes |
private void displayMissingDependencyOnLatest(ResolveReport originalReport, ResolveReport latestReport) { List<ModuleRevisionId> listOfMissingDependencyOnLatest = new ArrayList<>(); for (IvyNode originalDependency : originalReport.getDependencies()) { boolean dependencyFound = false; for (IvyNode latest : latestReport.getDependencies()) { if (originalDependency.getModuleId().equals(latest.getModuleId())) { dependencyFound = true; } } if (!dependencyFound) { listOfMissingDependencyOnLatest.add(originalDependency.getId()); } } if (listOfMissingDependencyOnLatest.size() > 0) { log("List of missing dependency on latest resolve :"); for (ModuleRevisionId moduleRevisionId : listOfMissingDependencyOnLatest) { log("\t" + moduleRevisionId.toString()); } } }
Example #10
Source File: IvyDeliverTest.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Test case for IVY-404. * * @throws Exception if something goes wrong * @see <a href="https://issues.apache.org/jira/browse/IVY-404">IVY-404</a> */ @Test public void testWithBranch() throws Exception { project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-branch.xml"); IvyResolve res = new IvyResolve(); res.setProject(project); res.execute(); deliver.setPubrevision("1.2"); deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml"); deliver.execute(); // should have done the ivy delivering File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml"); assertTrue(deliveredIvyFile.exists()); ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor( new IvySettings(), deliveredIvyFile.toURI().toURL(), true); assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId()); DependencyDescriptor[] dds = md.getDependencies(); assertEquals(1, dds.length); assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"), dds[0].getDependencyRevisionId()); }
Example #11
Source File: DependencyResolverIvyPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) { ModuleVersionPublisher publisher = repository.createPublisher(); IvyPublicationIdentity projectIdentity = publication.getProjectIdentity(); ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision()); ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId); DefaultModuleVersionPublishMetaData publishMetaData = new DefaultModuleVersionPublishMetaData(moduleVersionIdentifier); try { for (IvyArtifact publishArtifact : publication.getArtifacts()) { Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId); publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile()); } Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null); publishMetaData.addArtifact(artifact, publication.getDescriptorFile()); publisher.publish(publishMetaData); } catch (IOException e) { throw new UncheckedIOException(e); } }
Example #12
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 5 votes |
private ArtifactOrigin getDefaultMetadataArtifactOrigin(ModuleRevisionId mrid) { final String location; try { location = this.getIvyFileInCache(mrid).toURI().toURL().toExternalForm(); } catch (MalformedURLException e) { throw new RuntimeException("Failed to determine artifact origin for " + mrid); } // it's important to say the origin is not local to make sure it won't ever be used for // anything else than original token return new ArtifactOrigin(DefaultArtifact.newIvyArtifact(mrid, null), false, location); }
Example #13
Source File: IvyTranslations.java From jeka with Apache License 2.0 | 5 votes |
static Artifact toPublishedArtifact(JkIvyPublication.JkPublicationArtifact artifact, ModuleRevisionId moduleId, Instant date) { final String artifactName = JkUtilsString.isBlank(artifact.name) ? moduleId.getName() : artifact.name; final String extension = JkUtilsObject.firstNonNull(artifact.extension, ""); final String type = JkUtilsObject.firstNonNull(artifact.type, extension); return new DefaultArtifact(moduleId, new Date(date.toEpochMilli()), artifactName, type, extension); }
Example #14
Source File: DualResolverTest.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Test fails due to bad resolver configuration * * @throws ParseException if something goes wrong */ @Test(expected = IllegalStateException.class) public void testBad() throws ParseException { DualResolver dual = new DualResolver(); dual.setIvyResolver(new IBiblioResolver()); DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor( ModuleRevisionId.newInstance("org", "mod", "rev"), false); dual.getDependency(dd, data); }
Example #15
Source File: DefaultDependencyMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<ComponentArtifactMetaData> getArtifacts(ConfigurationMetaData fromConfiguration, ConfigurationMetaData toConfiguration) { String[] targetConfigurations = fromConfiguration.getHierarchy().toArray(new String[fromConfiguration.getHierarchy().size()]); DependencyArtifactDescriptor[] dependencyArtifacts = dependencyDescriptor.getDependencyArtifacts(targetConfigurations); if (dependencyArtifacts.length == 0) { return Collections.emptySet(); } Set<ComponentArtifactMetaData> artifacts = new LinkedHashSet<ComponentArtifactMetaData>(); for (DependencyArtifactDescriptor artifactDescriptor : dependencyArtifacts) { ModuleRevisionId id = toConfiguration.getComponent().getDescriptor().getModuleRevisionId(); Artifact artifact = new DefaultArtifact(id, null, artifactDescriptor.getName(), artifactDescriptor.getType(), artifactDescriptor.getExt(), artifactDescriptor.getUrl(), artifactDescriptor.getQualifiedExtraAttributes()); artifacts.add(toConfiguration.getComponent().artifact(artifact)); } return artifacts; }
Example #16
Source File: PatternVersionMatcher.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public boolean isDynamic(ModuleRevisionId askedMrid) { init(); String revision = askedMrid.getRevision(); int bracketIndex = revision.indexOf('('); if (bracketIndex > 0) { revision = revision.substring(0, bracketIndex); } return revisionMatches.containsKey(revision); }
Example #17
Source File: IvyResolveTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testInline() { // same as before, but expressing dependency directly without ivy file resolve.setOrganisation("org1"); resolve.setModule("mod1.2"); resolve.setRevision("2.0"); resolve.setInline(true); resolve.execute(); // dependencies assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")) .exists()); assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists()); }
Example #18
Source File: SearchTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testListModulesWithExtraAttributes() throws ParseException, IOException { Ivy ivy = Ivy.newInstance(); ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml")); IvySettings settings = ivy.getSettings(); Map<String, String> extendedAttributes = new HashMap<>(); extendedAttributes.put("e:att1", "extraatt"); extendedAttributes.put("e:att2", "extraatt2"); ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", "*", extendedAttributes); ModuleRevisionId[] mrids = ivy.listModules(criteria, settings.getMatcher(PatternMatcher.REGEXP)); assertEquals(2, mrids.length); ModuleRevisionId mrid = mrids[0]; assertEquals("extraatt", mrid.getExtraAttribute("att1")); Map<String, String> extraAttributes = mrid.getExtraAttributes(); assertEquals(2, extraAttributes.size()); assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att1")); assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att2")); Map<String, String> qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes(); assertEquals(2, qualifiedExtraAttributes.size()); assertTrue(qualifiedExtraAttributes.toString(), qualifiedExtraAttributes.keySet().contains("e:att1")); assertTrue(qualifiedExtraAttributes.toString(), qualifiedExtraAttributes.keySet().contains("e:att2")); }
Example #19
Source File: ResolveEngineTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testLocateThenDownload() { ResolveEngine engine = new ResolveEngine(ivy.getSettings(), ivy.getEventManager(), ivy.getSortEngine()); testLocateThenDownload(engine, DefaultArtifact.newIvyArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date()), new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml")); testLocateThenDownload(engine, new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar"), new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar")); }
Example #20
Source File: OBRResolverTest.java From ant-ivy with Apache License 2.0 | 5 votes |
private void genericTestResolveDownload(DependencyResolver resolver, ModuleRevisionId mrid) throws ParseException { ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data); assertNotNull(rmr); assertEquals(mrid, rmr.getId()); Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0]; DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions()); assertNotNull(report); assertEquals(1, report.getArtifactsReports().length); ArtifactDownloadReport ar = report.getArtifactReport(artifact); assertNotNull(ar); assertEquals(artifact, ar.getArtifact()); assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus()); // test to ask to download again, should use cache report = resolver.download(new Artifact[] {artifact}, new DownloadOptions()); assertNotNull(report); assertEquals(1, report.getArtifactsReports().length); ar = report.getArtifactReport(artifact); assertNotNull(ar); assertEquals(artifact, ar.getArtifact()); assertEquals(DownloadStatus.NO, ar.getDownloadStatus()); }
Example #21
Source File: P2DescriptorTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testResolveNotZipped() throws Exception { settings.setDefaultResolver("p2-zipped"); ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.eclipse.e4.core.services", "1.0.0.v20120521-2346"); ResolvedModuleRevision rmr = p2ZippedResolver.getDependency( new DefaultDependencyDescriptor(mrid, false), data); assertNotNull(rmr); assertEquals(mrid, rmr.getId()); assertEquals(1, rmr.getDescriptor().getAllArtifacts().length); DownloadOptions options = new DownloadOptions(); DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(), options); assertNotNull(report); assertEquals(1, report.getArtifactsReports().length); Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0]; ArtifactDownloadReport ar = report.getArtifactReport(artifact); assertNotNull(ar); assertEquals(artifact, ar.getArtifact()); assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus()); assertNull(ar.getUnpackedLocalFile()); }
Example #22
Source File: DefaultDependencyMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public Set<ComponentArtifactMetaData> getArtifacts(ConfigurationMetaData fromConfiguration, ConfigurationMetaData toConfiguration) { String[] targetConfigurations = fromConfiguration.getHierarchy().toArray(new String[fromConfiguration.getHierarchy().size()]); DependencyArtifactDescriptor[] dependencyArtifacts = dependencyDescriptor.getDependencyArtifacts(targetConfigurations); if (dependencyArtifacts.length == 0) { return Collections.emptySet(); } Set<ComponentArtifactMetaData> artifacts = new LinkedHashSet<ComponentArtifactMetaData>(); for (DependencyArtifactDescriptor artifactDescriptor : dependencyArtifacts) { ModuleRevisionId id = toConfiguration.getComponent().getDescriptor().getModuleRevisionId(); Artifact artifact = new DefaultArtifact(id, null, artifactDescriptor.getName(), artifactDescriptor.getType(), artifactDescriptor.getExt(), artifactDescriptor.getUrl(), artifactDescriptor.getQualifiedExtraAttributes()); artifacts.add(toConfiguration.getComponent().artifact(artifact)); } return artifacts; }
Example #23
Source File: InstallTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testSimpleWithoutDefaultResolver() throws Exception { Ivy ivy = Ivy.newInstance(); ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml")); ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), "test", "install", new InstallOptions()); assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists()); assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists()); }
Example #24
Source File: PomModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testParentDependencyMgt() throws ParseException, IOException { settings.setDictatorResolver(new MockResolver() { public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException { try { ModuleDescriptor moduleDescriptor = PomModuleDescriptorParser.getInstance() .parseDescriptor(settings, getClass().getResource("test-dependencyMgt.pom"), false); return new ResolvedModuleRevision(null, null, moduleDescriptor, null); } catch (IOException e) { throw new AssertionError(e); } } }); ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-parentDependencyMgt.pom"), false); assertNotNull(md); assertEquals(ModuleRevisionId.newInstance("org.apache", "test-parentdep", "1.0"), md.getModuleRevisionId()); DependencyDescriptor[] dds = md.getDependencies(); assertNotNull(dds); assertEquals(2, dds.length); assertEquals( ModuleRevisionId.newInstance("commons-collection", "commons-collection", "1.0.5"), dds[0].getDependencyRevisionId()); assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), dds[1].getDependencyRevisionId()); ExcludeRule[] excludes = dds[0].getAllExcludeRules(); assertNotNull(excludes); assertEquals(2, excludes.length); assertEquals("javax.mail", excludes[0].getId().getModuleId().getOrganisation()); assertEquals("mail", excludes[0].getId().getModuleId().getName()); assertEquals("javax.jms", excludes[1].getId().getModuleId().getOrganisation()); assertEquals("jms", excludes[1].getId().getModuleId().getName()); }
Example #25
Source File: DependencyResolverIvyPublisher.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private Artifact createIvyArtifact(IvyArtifact ivyArtifact, ModuleRevisionId moduleRevisionId) { Map<String, String> extraAttributes = new HashMap<String, String>(); if (GUtil.isTrue(ivyArtifact.getClassifier())) { extraAttributes.put(Dependency.CLASSIFIER, ivyArtifact.getClassifier()); } return new DefaultArtifact( moduleRevisionId, null, GUtil.elvis(ivyArtifact.getName(), moduleRevisionId.getName()), ivyArtifact.getType(), ivyArtifact.getExtension(), extraAttributes); }
Example #26
Source File: URLResolverTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testDownloadWithUseOriginIsTrue() throws Exception { URLResolver resolver = new URLResolver(); resolver.setSettings(settings); String rootpath = new File("test/repositories/1").toURI().toURL().toExternalForm(); resolver.addIvyPattern(rootpath + "/[organisation]/[module]/ivys/ivy-[revision].xml"); resolver.addArtifactPattern(rootpath + "/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"); resolver.setName("test"); ((DefaultRepositoryCacheManager) resolver.getRepositoryCacheManager()).setUseOrigin(true); assertEquals("test", resolver.getName()); ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"); ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data); assertNotNull(rmr); assertEquals(mrid, rmr.getId()); Date pubdate = new GregorianCalendar(2004, 10, 1, 11, 0, 0).getTime(); assertEquals(pubdate, rmr.getPublicationDate()); // test to ask to download DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate, "mod1.1", "jar", "jar"); DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions()); assertNotNull(report); assertEquals(1, report.getArtifactsReports().length); ArtifactDownloadReport ar = report.getArtifactReport(artifact); assertNotNull(ar); assertEquals(artifact, ar.getArtifact()); assertEquals(DownloadStatus.NO, ar.getDownloadStatus()); }
Example #27
Source File: JarResolverTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testSimpleFile() throws Exception { JarResolver resolver = new JarResolver(); resolver.setName("jarresolver1"); resolver.setFile(new File("test/jar-repos/jarrepo1.jar").getAbsolutePath()); resolver.addIvyPattern("[organisation]/[module]/ivys/ivy-[revision].xml"); resolver.addArtifactPattern("[organisation]/[module]/[type]s/[artifact]-[revision].[type]"); resolver.setSettings(settings); ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"); ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data); assertNotNull(rmr); }
Example #28
Source File: PomModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testReal2() throws Exception { ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("wicket-1.3-incubating-SNAPSHOT.pom"), false); assertNotNull(md); assertEquals( ModuleRevisionId.newInstance("org.apache.wicket", "wicket", "1.3-incubating-SNAPSHOT"), md.getModuleRevisionId()); }
Example #29
Source File: MRIDTransformationRule.java From ant-ivy with Apache License 2.0 | 5 votes |
public ModuleRevisionId transform(ModuleRevisionId mrid) { MridRuleMatcher matcher = new MridRuleMatcher(); for (MRIDRule rule : src) { if (matcher.match(rule, mrid)) { ModuleRevisionId destMrid = matcher.apply(dest, mrid); Message.debug("found matching namespace rule: " + rule + ". Applied " + dest + " on " + mrid + ". Transformed to " + destMrid); return destMrid; } } return mrid; }
Example #30
Source File: IvyXmlModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void mergeAll(ModuleDescriptor parent) { ModuleRevisionId sourceMrid = parent.getModuleRevisionId(); mergeInfo(parent); mergeConfigurations(sourceMrid, parent.getConfigurations()); mergeDependencies(parent.getDependencies()); mergeDescription(parent.getDescription()); }