本文整理汇总了Java中org.apache.ivy.Ivy.configure方法的典型用法代码示例。如果您正苦于以下问题:Java Ivy.configure方法的具体用法?Java Ivy.configure怎么用?Java Ivy.configure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.Ivy
的用法示例。
在下文中一共展示了Ivy.configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIVY1236
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
* Test case for IVY-1236.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1236">IVY-1236</a>
*/
@Test
public void testIVY1236() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-1236/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-1236/ivy.xml"),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertNotNull(report.getUnresolvedDependencies());
assertEquals("Number of unresolved dependencies not correct", 0,
report.getUnresolvedDependencies().length);
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("myorg", "modB", "1.0")).exists());
assertTrue(getArchiveFileInCache("myorg", "modB", "1.0", "modB", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("myorg", "modB", "1.0", "modB-A", "jar", "jar").exists());
}
示例2: testMaven
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testMaven() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
@SuppressWarnings("unused")
ResolveReport rr = ivy.install(ModuleRevisionId.newInstance("org.apache", "test", "1.0"),
ivy.getSettings().getDefaultResolver().getName(), "install", new InstallOptions());
assertTrue(new File("build/test/install/org.apache/test/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org.apache/test/test-1.0.jar").exists());
// the original descriptor is not installed
assertFalse(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
ivy.install(ModuleRevisionId.newInstance("org.apache", "test", "1.0"), ivy.getSettings()
.getDefaultResolver().getName(), "install", new InstallOptions()
.setInstallOriginalMetadata(true).setOverwrite(true));
// the original descriptor is installed now, too
assertTrue(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
}
示例3: testLatestTime1
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
* Test case for IVY-407.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-407">IVY-407</a>
*/
@Test
public void testLatestTime1() 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-1.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());
}
}
}
示例4: testIVY1233
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
* Test case for IVY-1233.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1233">IVY-1233</a>
*/
@Test
public void testIVY1233() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-1233/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport rr = ivy.resolve(new File("test/repositories/IVY-1233/ivy.xml"),
getResolveOptions(new String[] {"*"}));
ConfigurationResolveReport crr = rr.getConfigurationReport("default");
Set<ModuleRevisionId> modRevIds = crr.getModuleRevisionIds();
assertEquals(3, modRevIds.size());
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "a", "1.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "b", "2.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "c", "3.0")));
}
示例5: testNamespaceMapping3
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testNamespaceMapping3() throws Exception {
// same as 2 but with poms
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/namespace/ivysettings.xml"));
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-namespace3.xml"),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "namespace", "3.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("systemorg2", "system-2", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "systemorg2", "system-2", "1.0", "2", "jar", "jar")
.exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("systemorg2", "system-1", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "systemorg2", "system-1", "1.0", "1", "jar", "jar")
.exists());
}
示例6: testFromCacheOnly
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testFromCacheOnly() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/bugIVY-56/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
// ResolveReport report = ivy.resolve(new
// File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
// getResolveOptions(new String[] {"*"}));
// // should have an error, the conf is bad and the dependency should not be found
// assertTrue(report.hasError());
// put necessary stuff in cache, and it should now be ok
File ivyfile = getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
File art = getArchiveFileInCache(ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar");
FileUtil.copy(ResolveTest.class.getResource("ivy-mod1.2.xml"), ivyfile, null, null);
FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), art, null);
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
getResolveOptions(ivy.getSettings(), new String[] {"*"}));
assertFalse(report.hasError());
}
示例7: testResolveTransitivelyToRelocatedPom
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveTransitivelyToRelocatedPom() throws Exception {
ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ivy.pushContext();
try {
ResolveReport report = ivy.resolve(new File(
"test/repositories/m2/org/relocated/testRelocationUser/1.0/"
+ "testRelocationUser-1.0.pom"),
getResolveOptions(new String[] {"compile"}));
assertNotNull(report);
assertFalse(report.hasError());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.0", "test2", "jar",
"jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.0", "test", "jar", "jar")
.exists());
} finally {
ivy.popContext();
}
}
示例8: testNoAttributesForcedDependencies
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testNoAttributesForcedDependencies() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File(
"test/repositories/extra-attributes-forceddependencies/ivysettings-filerepo-noattribs.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport report = ivy.resolve(
ResolveTest.class.getResource("ivy-extra-attrib-forced-dependencies.xml"),
getResolveOptions(ivy.getSettings(), new String[] {"*"}).setValidate(false));
assertFalse(report.hasError());
ivy.deliver("1.0.0", deliverDir.getAbsolutePath() + "/ivy-1.0.0.xml", new DeliverOptions()
.setResolveId(report.getResolveId()).setValidate(false).setPubdate(new Date()));
File deliveredIvyFile = new File(deliverDir, "ivy-1.0.0.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(2, dds.length);
assertEquals(
ModuleRevisionId.newInstance("CAE-Visualization-Components", "SGL", "MAIN", "6.2.34.7"),
dds[1].getDependencyRevisionId());
}
示例9: testExtraAttributes3
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
* Test case for IVY-745.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-745">IVY-745</a>
*/
@Test
public void testExtraAttributes3() throws Exception {
MockMessageLogger mockLogger = new MockMessageLogger();
Ivy ivy = new Ivy();
ivy.getLoggerEngine().setDefaultLogger(mockLogger);
ivy.configure(new File("test/repositories/extra-attributes/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ivy.getSettings().validate();
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att3.xml"),
getResolveOptions(ivy.getSettings(), new String[] {"*"}).setValidate(false));
assertTrue(report.hasError());
// should report error about missing extra attribute in dependency module descriptor
mockLogger.assertLogContains("expected='task2' found='null'");
}
示例10: testResolveVersionRelocationChainedWithGroupRelocation
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveVersionRelocationChainedWithGroupRelocation() throws Exception {
ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ivy.pushContext();
try {
ResolveReport report = ivy.resolve(new File(
"test/repositories/m2/org/relocated/test3/1.1/test3-1.1.pom"),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.0", "test2", "jar",
"jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.0"))
.exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.0", "test", "jar", "jar")
.exists());
} finally {
ivy.popContext();
}
}
示例11: testTypedefWithCustomClasspath
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testTypedefWithCustomClasspath() throws Exception {
Ivy ivy = new Ivy();
ivy.setVariable("ivy.custom.test.dir", new File("test/java/org/apache/ivy/core/settings")
.toURI().toURL().toString());
ivy.configure(ConfigureTest.class.getResource("ivysettings-custom-typedef.xml"));
DependencyResolver custom = ivy.getSettings().getResolver("custom");
assertNotNull(custom);
assertEquals("org.apache.ivy.plugins.resolver.CustomResolver", custom.getClass().getName());
}
示例12: testBug148
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testBug148() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/bug148/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ivy.resolve(ResolveTest.class.getResource("ivy-148.xml"),
getResolveOptions(new String[] {"*"}));
assertTrue(new File("build/cache/jtv-foo/bar/ivy-1.1.0.0.xml").exists());
assertTrue(new File("build/cache/jtv-foo/bar/jars/bar-1.1.0.0.jar").exists());
assertTrue(new File("build/cache/idautomation/barcode/ivy-4.10.xml").exists());
assertTrue(new File("build/cache/idautomation/barcode/jars/LinearBarCode-4.10.jar")
.exists());
}
示例13: testResolveMaven2WithConflict2
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveMaven2WithConflict2() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-874.xml"),
getResolveOptions(new String[] {"default"}));
assertFalse(report.hasError());
assertContainsArtifact(report.getConfigurationReport("default"),
getArtifact("org.apache", "test3", "1.1", "test3", "jar", "jar"));
assertContainsArtifact(report.getConfigurationReport("default"),
getArtifact("org.apache", "test2", "1.1", "test2", "jar", "jar"));
assertContainsArtifact(report.getConfigurationReport("default"),
getArtifact("org.apache", "test", "1.2", "test", "jar", "jar"));
}
示例14: setUp
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
ivy = new Ivy();
ivy.configure(RegexpConflictManagerTest.class.getResource("ivysettings-regexp-test.xml"));
cache = new File("build/cache");
cache.mkdirs();
}
示例15: testIVY151
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
* Test case for IVY-1151.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1151">IVY-1151</a>
*/
@Test
public void testIVY151() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/multirevisions/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/multirevisions/ivy.xml"),
getResolveOptions(new String[] {"compile", "test"}));
assertNotNull(report);
assertNotNull(report.getUnresolvedDependencies());
assertEquals("Number of unresolved dependencies not correct", 0,
report.getUnresolvedDependencies().length);
}