Package org.apache.ivy

Examples of org.apache.ivy.Ivy


    }

    public void testForceLocal() throws Exception {
        // mod2.1 depends on mod1.1 which depends on mod1.2
        // a local build for mod1.2 is available
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/ivysettings-local.xml"));
        ResolveReport report = ivy.resolve(new File(
                "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
View Full Code Here


    }

    public void testForceLocal2() throws Exception {
        // mod2.3 -> mod2.1;[0.0,0.4] -> mod1.1 -> mod1.2
        // a local build for mod2.1 and mod1.2 is available
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/ivysettings-local.xml"));
        ResolveReport report = ivy.resolve(new File(
                "test/repositories/1/org2/mod2.3/ivys/ivy-0.8.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
View Full Code Here

        assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
                .exists());
        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());

        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/ivysettings-local.xml"));
        ResolveReport report = ivy.resolve(new File(
                "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
View Full Code Here

    public void setMerge(boolean merge) {
        this.merge = merge;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        organisation = getProperty(organisation, settings, "ivy.organisation", resolveId);
        module = getProperty(module, settings, "ivy.module", resolveId);
        revision = getProperty(revision, settings, "ivy.revision", resolveId);
        pubBranch = getProperty(pubBranch, settings, "ivy.deliver.branch");
        pubRevision = getProperty(pubRevision, settings, "ivy.deliver.revision");
        deliverpattern = getProperty(deliverpattern, settings, "ivy.deliver.ivy.pattern");
        status = getProperty(status, settings, "ivy.status");
        if (deliveryList == null) {
            String deliveryListPath = getProperty(settings, "ivy.delivery.list.file");
            if (deliveryListPath == null) {
                deliveryList = new File(System.getProperty("java.io.tmpdir")
                        + "/delivery.properties");
            } else {
                deliveryList = getProject().resolveFile(settings.substitute(deliveryListPath));
            }
        }
        if (resolveId == null) {
            if (organisation == null) {
                throw new BuildException("no organisation provided for ivy deliver task: "
                        + "It can either be set explicitely via the attribute 'organisation' "
                        + "or via 'ivy.organisation' property or a prior call to <resolve/>");
            }
            if (module == null) {
                throw new BuildException("no module name provided for ivy deliver task: "
                        + "It can either be set explicitely via the attribute 'module' "
                        + "or via 'ivy.module' property or a prior call to <resolve/>");
            }
        }
        if (revision == null) {
            revision = Ivy.getWorkingRevision();
        }
        Date pubdate = getPubDate(this.pubdate, new Date());
        if (pubRevision == null) {
            if (revision.startsWith("working@")) {
                pubRevision = DateUtil.format(pubdate);
            } else {
                pubRevision = revision;
            }
        }
        if (deliverpattern == null) {
            throw new BuildException(
                    "deliver ivy pattern is missing: either provide it as parameters "
                            + "or through ivy.deliver.ivy.pattern properties");
        }
        if (status == null) {
            throw new BuildException(
                    "no status provided: either provide it as parameter or through "
                            + "the ivy.status.default property");
        }

        ModuleRevisionId mrid = null;
        if (resolveId == null) {
            mrid = ModuleRevisionId.newInstance(organisation, module, revision);
        }
        boolean isLeading = false;
        try {
            if (!deliveryList.exists()) {
                isLeading = true;
            }

            loadDeliveryList();

            PublishingDependencyRevisionResolver drResolver;
            if (deliverTarget != null && deliverTarget.trim().length() > 0) {
                drResolver = new DeliverDRResolver();
            } else {
                drResolver = new DefaultPublishingDRResolver();
            }

            DeliverOptions options = new DeliverOptions(status, pubdate, drResolver,
                    doValidate(settings), replacedynamicrev, splitConfs(conf))
                    .setResolveId(resolveId).setReplaceForcedRevisions(isReplaceForcedRev())
                    .setGenerateRevConstraint(generateRevConstraint).setMerge(merge)
                    .setPubBranch(pubBranch);
            if (mrid == null) {
                ivy.deliver(pubRevision, deliverpattern, options);
            } else {
                ivy.deliver(mrid, pubRevision, deliverpattern, options);
            }
        } catch (Exception e) {
            throw new BuildException("impossible to deliver " + mrid == null ? resolveId : mrid
                    + ": " + e, e);
        } finally {
View Full Code Here

                .exists());
    }

    public void testResolveSeveralDefaultWithArtifactsAndConfs() throws Exception {
        // test case for IVY-283
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/IVY-283/ivysettings.xml"));
        ResolveReport report = ivy.resolve(new File("test/repositories/IVY-283/ivy.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
        ConfigurationResolveReport crr = report.getConfigurationReport("build");
View Full Code Here

                .exists());
    }

    public void testResolveSeveralDefaultWithArtifactsAndConfs2() throws Exception {
        // second test case for IVY-283
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/IVY-283/ivysettings.xml"));
        ResolveReport report = ivy.resolve(new File("test/repositories/IVY-283/ivy-d.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
        ConfigurationResolveReport crr = report.getConfigurationReport("build");
View Full Code Here

    public void testResolveConflict3() throws Exception {
        // test case for IVY-264
        // a depends on x latest, y latest, z latest
        // x and z depends on commons-lang 1.0.1
        // y depends on commons-lang 2.0
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/IVY-264/ivysettings.xml"));
        ResolveReport report = ivy.resolve(new File("test/repositories/IVY-264/ivy.xml"),
            getResolveOptions(new String[] {"*"}));
        assertFalse(report.hasError());

        // dependencies
        ConfigurationResolveReport crr = report.getConfigurationReport("default");
View Full Code Here

    public void testResolveWithDynamicRevisionsAndArtifactLockStrategy() throws Exception {
        // mod4.1 v 4.5 depends on
        // - mod1.2 v 1+ and forces it
        // - mod3.1 v 1.2 which depends on mod1.2 v 2+
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/ivysettings-artifact-lock.xml"));
        ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.5.xml"),
            getResolveOptions(new String[] {"*"}));

        List lockFiles = new ArrayList();
        findLockFiles(cache, lockFiles);
        assertTrue("There were lockfiles left in the cache: " + lockFiles, lockFiles.isEmpty());
View Full Code Here

        // The test verify that latest.integration dependencies can be resolved
        // when using a resolver with multiple patterns, when only the first pattern
        // finds something - test case for IVY-602

        // mod9.2 depends on latest.integration of mod6.2
        Ivy ivy = Ivy.newInstance();
        ivy.configure(new File("test/repositories/ivysettings-IVY602.xml"));

        ResolveReport report = ivy.resolve(new File(
                "test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml"),
            getResolveOptions(new String[] {"default"}));
        assertNotNull(report);
        assertFalse(report.hasError());
View Full Code Here

        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
    }

    public void testResolveModeDynamicWithBranch1() throws Exception {
        // bar1;5 -> foo1#branch1|;2|[0,4]
        Ivy ivy = new Ivy();
        ivy.configure(new File("test/repositories/branches/ivysettings.xml"));

        ResolveReport report = ivy.resolve(new File(
                "test/repositories/branches/bar/bar1/trunk/5/ivy.xml"),
            getResolveOptions(new String[] {"*"})
                    .setResolveMode(ResolveOptions.RESOLVEMODE_DYNAMIC));
        assertFalse(report.hasError());

View Full Code Here

TOP

Related Classes of org.apache.ivy.Ivy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.