当前位置: 首页>>代码示例>>Java>>正文


Java Ivy.resolve方法代码示例

本文整理汇总了Java中org.apache.ivy.Ivy.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java Ivy.resolve方法的具体用法?Java Ivy.resolve怎么用?Java Ivy.resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ivy.Ivy的用法示例。


在下文中一共展示了Ivy.resolve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResolveMaven2Snapshot1

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
 * Test case for IVY-501.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-501">IVY-501</a>
 */
@Test
public void testResolveMaven2Snapshot1() throws Exception {
    // here we test maven SNAPSHOT versions handling,
    // with m2 snapshotRepository/uniqueVersion set to true
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/m2/org/apache/test4/1.0/test4-1.0.pom"),
        getResolveOptions(new String[] {"*"}));
    assertNotNull(report);
    assertFalse(report.hasError());

    // dependencies
    assertTrue(getIvyFileInCache(
        ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT"))
            .exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT",
        "test-SNAPSHOT1", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:ResolveTest.java

示例2: testExternalArtifacts

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testExternalArtifacts() throws Exception {
    Ivy ivy = Ivy.newInstance();
    ivy.getSettings().setVariable("test.base.url",
        new File("test/repositories/external-artifacts").toURI().toURL().toExternalForm());
    ivy.configure(new File("test/repositories/external-artifacts/ivysettings.xml"));

    ResolveReport report = ivy.resolve(
        new File("test/repositories/external-artifacts/ivy.xml"),
        getResolveOptions(ivy.getSettings(), new String[] {"*"}).setValidate(false));
    assertFalse(report.hasError());

    assertTrue(getArchiveFileInCache(ivy, "apache", "A", "1.0", "a", "jar", "jar").exists());
    assertTrue(getArchiveFileInCache(ivy, "apache", "B", "2.0", "b", "jar", "jar").exists());
    assertTrue(getArchiveFileInCache(ivy, "apache", "C", "3.0", "C", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:ResolveTest.java

示例3: testResolveWithConflictManagerPerModule

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
 * Test case for IVY-448.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-448">IVY-448</a>
 */
@Test
public void testResolveWithConflictManagerPerModule() throws Exception {
    // all modules from myorg
    // module1
    // -> module2-1.0
    // -> module3-2.0
    // module2
    // -> module3-1.0
    // settings use 'all' as default conflict manager, and latest-revision for modules from
    // myorg
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/IVY-448/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/IVY-448/ivy.xml"),
        getResolveOptions(new String[] {"*"}));
    assertFalse(report.hasError());

    // rev 1.0 should have been evicted by latest-revision conflict manager
    assertTrue(getArchiveFileInCache(ivy, "myorg", "module3", "2.0", "module3", "jar", "jar")
            .exists());
    assertFalse(getArchiveFileInCache(ivy, "myorg", "module3", "1.0", "module3", "jar", "jar")
            .exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:29,代码来源:ResolveTest.java

示例4: testResolveTransitivelyToPomRelocatedToNewVersion

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveTransitivelyToPomRelocatedToNewVersion() 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.1/"
                        + "testRelocationUser-1.1.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();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveTest.java

示例5: testBranches6

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
 * Test case for IVY-717.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-717">IVY-717</a>
 */
@Test
public void testBranches6() throws Exception {
    // bar1;4 -> foo#foo1#${ivy.branch};5
    // foo#foo1#branch1;5 -> foo#foo2#${ivy.branch};1
    // foo#foo1#trunk;5 -> {}

    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/branches/ivysettings.xml"));

    ivy.setVariable("ivy.branch", "branch1");
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/branches/bar/bar1/trunk/4/ivy.xml"),
        getResolveOptions(new String[] {"*"}).setValidate(false));
    assertFalse(report.hasError());

    assertTrue(getArchiveFileInCache(ivy, "foo#foo1#branch1;5", "foo1", "jar", "jar").exists());
    assertTrue(getArchiveFileInCache(ivy, "foo#foo2#branch1;1", "foo2", "jar", "jar").exists());

    ivy.setVariable("ivy.branch", "trunk");
    report = ivy.resolve(new File("test/repositories/branches/bar/bar1/trunk/4/ivy.xml"),
        getResolveOptions(new String[] {"*"}).setValidate(false));
    assertFalse(report.hasError());
    assertEquals(1, report.getConfigurationReport("default").getNodesNumber());
    assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;5", "foo1", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:32,代码来源:ResolveTest.java

示例6: testResolveMaven2WithConflict

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveMaven2WithConflict() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/m2/org/apache/test3/1.1/test3-1.1.pom"),
        getResolveOptions(new String[] {"default"}));
    assertFalse(report.hasError());

    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.1"))
            .exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.1", "test2", "jar", "jar")
            .exists());

    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.1"))
            .exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.1", "test", "jar", "jar")
            .exists());

    assertContainsArtifact(report.getConfigurationReport("default"),
        getArtifact("org.apache", "test2", "1.1", "test2", "jar", "jar"));
    assertContainsArtifact(report.getConfigurationReport("default"),
        getArtifact("org.apache", "test", "1.1", "test", "jar", "jar"));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:ResolveTest.java

示例7: testExtraAttributesForcedDependencies

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testExtraAttributesForcedDependencies() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File(
            "test/repositories/extra-attributes-forceddependencies/ivysettings-filerepo-attribs.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());

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveTest.java

示例8: testResolveMaven2Snapshot2AsLatestIntegration

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
/**
 * Test case for IVY-1036.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1036">IVY-1036</a>
 */
@Test
public void testResolveMaven2Snapshot2AsLatestIntegration() throws Exception {
    // here we test maven SNAPSHOT versions handling,
    // with m2 snapshotRepository/uniqueVersion set to true
    // but retrieving by latest.integration
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(
        ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT2", "latest.integration"),
        getResolveOptions(new String[] {"*(public)"}), true);
    assertNotNull(report);
    assertFalse(report.hasError());

    // dependencies
    assertTrue(getIvyFileInCache(
        ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT2", "2.0.2-SNAPSHOT"))
            .exists());
    assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-SNAPSHOT2", "2.0.2-SNAPSHOT",
        "test-SNAPSHOT2", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveTest.java

示例9: testResolveMaven2GetSources

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveMaven2GetSources() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(
        ResolveTest.class.getResource("ivy-m2-with-sources.xml"),
        getResolveOptions(new String[] {"*"}));
    assertNotNull(report);
    assertFalse(report.hasError());

    assertTrue(getIvyFileInCache(
        ModuleRevisionId.newInstance("org.apache", "test-sources", "1.0")).exists());
    File jarFileInCache = getArchiveFileInCache(ivy, "org.apache", "test-sources", "1.0",
        "test-sources", "jar", "jar");
    assertTrue(jarFileInCache.exists());
    File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", "test-sources", null,
        "1.0", "test-sources", "source", "jar",
        Collections.singletonMap("classifier", "sources"));
    assertTrue(sourceFileInCache.exists());
    assertTrue(jarFileInCache.length() != sourceFileInCache.length());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:ResolveTest.java

示例10: 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")));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:ResolveTest.java

示例11: testResolveMaven2GetSourcesAndJavadocAuto

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveMaven2GetSourcesAndJavadocAuto() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
    ResolveReport report = ivy.resolve(
        ResolveTest.class.getResource("ivy-m2-with-sources-and-javadoc-auto.xml"),
        getResolveOptions(new String[] {"*"}));
    assertNotNull(report);
    assertFalse(report.hasError());

    assertTrue(getIvyFileInCache(
        ModuleRevisionId.newInstance("org.apache", "test-sources", "1.0")).exists());
    File jarFileInCache = getArchiveFileInCache(ivy, "org.apache", "test-sources", "1.0",
        "test-sources", "jar", "jar");
    assertTrue(jarFileInCache.exists());
    File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", "test-sources", null,
        "1.0", "test-sources", "source", "jar",
        Collections.singletonMap("classifier", "sources"));
    assertTrue(sourceFileInCache.exists());
    assertTrue(jarFileInCache.length() != sourceFileInCache.length());
    File javadocFileInCache = getArchiveFileInCache(ivy, "org.apache", "test-sources", null,
        "1.0", "test-sources", "javadoc", "jar",
        Collections.singletonMap("classifier", "javadoc"));
    assertTrue(javadocFileInCache.exists());
    assertTrue(jarFileInCache.length() != javadocFileInCache.length());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveTest.java

示例12: test

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
    assertFalse(new File("test/triggers/ant-build/A/A.jar").exists());

    Ivy ivy = new Ivy();
    ivy.configure(new File("test/triggers/ant-build/ivysettings.xml"));

    ResolveReport r = ivy.resolve(new File("test/triggers/ant-build/B/ivy.xml"));
    assertFalse(r.hasError());

    // should have triggered an A publish
    assertTrue(new File("test/triggers/ant-build/local/A/A.jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:14,代码来源:AntBuildTriggerTest.java

示例13: testBadFiles

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testBadFiles() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/badfile/ivysettings.xml"));

    ResolveReport report = ivy.resolve(
        new File("test/repositories/badfile/ivys/ivy-badorg.xml"),
        getResolveOptions(new String[] {"*"}));
    assertTrue("bad org should have raised an error in report", report.hasError());
    assertTrue(joinArray(report.getAllProblemMessages().toArray(new String[0]), "\n").contains("'badorg'"));

    report = ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badmodule.xml"),
        getResolveOptions(new String[] {"*"}));
    assertTrue("bad module should have raised an error in report", report.hasError());
    assertTrue(joinArray(report.getAllProblemMessages().toArray(new String[0]), "\n").contains("'badmodule'"));

    report = ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badbranch.xml"),
        getResolveOptions(new String[] {"*"}));
    assertTrue("bad branch should have raised an error in report", report.hasError());
    assertTrue(joinArray(report.getAllProblemMessages().toArray(new String[0]), "\n").contains("'badbranch'"));

    report = ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badrevision.xml"),
        getResolveOptions(new String[] {"*"}));
    assertTrue("bad revision should have raised an error in report", report.hasError());
    assertTrue(joinArray(report.getAllProblemMessages().toArray(new String[0]), "\n").contains("'badrevision'"));

    report = ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badxml.xml"),
        getResolveOptions(new String[] {"*"}));
    assertTrue("bad xml should have raised an error in report", report.hasError());
    assertTrue(joinArray(report.getAllProblemMessages().toArray(new String[0]), "\n").contains("badatt"));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:32,代码来源:ResolveTest.java

示例14: testResolveMaven2RelocationOfGroupId

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testResolveMaven2RelocationOfGroupId() throws Exception {
    // Same as testResolveMaven2 but with a relocated module pointing to the module
    // used in testResolveMaven2.
    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.0/test3-1.0.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();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:28,代码来源:ResolveTest.java

示例15: testFromCache2

import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testFromCache2() throws Exception {
    // mod1.1 depends on mod1.2

    Ivy ivy = ivyTestCache();

    // set up repository
    FileUtil.forceDelete(new File("build/testCache2"));
    File art = new File("build/testCache2/mod1.2-2.0.jar");
    FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), art, null);

    // we first do a simple resolve so that module is in cache
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
        getResolveOptions(new String[] {"*"}));
    assertFalse(report.hasError());

    // now we clean the repository to simulate repo not available (network pb for instance)
    FileUtil.forceDelete(new File("build/testCache2"));

    // now do a new resolve: it should use cached data
    report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
        getResolveOptions(new String[] {"*"}));
    assertFalse(report.hasError());

    ModuleDescriptor md = report.getModuleDescriptor();

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
    assertEquals(mrid, md.getModuleRevisionId());

    assertTrue(getResolvedIvyFileInCache(ivy, mrid).exists());

    // dependencies
    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
            .exists());
    assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:38,代码来源:ResolveTest.java


注:本文中的org.apache.ivy.Ivy.resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。