Package org.apache.ivy.core.resolve

Examples of org.apache.ivy.core.resolve.DownloadOptions


            IvyNode[] dependencies = resolveEngine.getDependencies(md, resolveOptions, report);
            report.setDependencies(Arrays.asList(dependencies), options.getArtifactFilter());

            Message.info(":: downloading artifacts to cache ::");
            resolveEngine.downloadArtifacts(report, options.getArtifactFilter(),
                new DownloadOptions());

            // now that everything is in cache, we can publish all these modules
            Message.info(":: installing in " + to + " ::");
            for (int i = 0; i < dependencies.length; i++) {
                ModuleDescriptor depmd = dependencies[i].getDescriptor();
View Full Code Here


                Artifact metaArtifact = artifacts[i];
                if (matcher.match(metaArtifact)) {
                    if (matcher.matchName(artifact, metaArtifact.getName())) {
                        // we've found a matching artifact, let's provision it
                        ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(
                            metaArtifact, new DownloadOptions());
                        if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
                            return getArtifactPath(metaAdr);
                        }
                    }
                    // keep a reference to the artifact so we could fall back
                    // to map-if-only-one
                    nbFound++;
                    foundArtifact = metaArtifact;
                }
            }
            if (mapIfOnlyOne) {
                // we haven't found artifact in the module declaring the artifact and having
                // a matching name.
                if (nbFound == 1) {
                    // If there is only 1 found artifact, it is the winner ;-)
                    ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(foundArtifact,
                        new DownloadOptions());
                    if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
                        return new Path(metaAdr.getLocalFile().getAbsolutePath());
                    }
                }
            }
View Full Code Here

                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);
View Full Code Here

        assertEquals(mrid, rmr.getId());

        assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);

        DownloadReport report = p2SourceResolver.download(rmr.getDescriptor().getAllArtifacts(),
            new DownloadOptions());
        assertNotNull(report);

        assertEquals(2, report.getArtifactsReports().length);

        for (int i = 0; i < 2; i++) {
            Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
            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
            DownloadReport report2 = p2SourceResolver.download(new Artifact[] {artifact},
                new DownloadOptions());
            assertNotNull(report2);

            assertEquals(1, report2.getArtifactsReports().length);

            ar = report2.getArtifactReport(artifact);
View Full Code Here

        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);
View Full Code Here

        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);

        DownloadOptions options = new DownloadOptions();
        DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
            options);
        assertNotNull(report);

        assertEquals(2, report.getArtifactsReports().length);
View Full Code Here

        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);

        DownloadOptions options = new DownloadOptions();
        DownloadReport report = p2WithPackedResolver.download(
            rmr.getDescriptor().getAllArtifacts(), options);
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);
View Full Code Here

                return new Path(metaArtifactFile.getAbsolutePath());
            } else if (attempt.exists()) {
                return null;
            } else {
                Message.info("checking " + metaType + " for " + artifact);
                ivy.getResolveEngine().download(metaArtifact, new DownloadOptions());
                if (metaArtifactFile.exists()) {
                    return new Path(metaArtifactFile.getAbsolutePath());
                }
                // meta artifact not found, we store this information to avoid other
                // attempts later
                Message.info(metaType + " not found for " + artifact);
                try {
                    attempt.getParentFile().mkdirs();
                    attempt.createNewFile();
                } catch (IOException e) {
                    Message.error("impossible to create attempt file " + attempt + ": " + e);
                }
                return null;
            }
        }
        Message.info("checking " + metaType + " for " + artifact);
        ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(metaArtifact,
            new DownloadOptions());
        if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) {
            return new Path(metaAdr.getLocalFile().getAbsolutePath());
        }
        Message.info(metaType + " not found for " + artifact);
        Message
View Full Code Here

    /**
     * Default implementation actually download the artifact Subclasses should overwrite this to
     * avoid the download
     */
    public ArtifactOrigin locate(Artifact artifact) {
        DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions());
        if (dr == null) {
            /*
             * according to IVY-831, it seems that this actually happen sometime, while the contract
             * of DependencyResolver says that it should never return null
             */
 
View Full Code Here

    protected CacheDownloadOptions getCacheDownloadOptions(DownloadOptions options) {
        return new CacheDownloadOptions().setListener(getDownloadListener(options));
    }

    protected DownloadOptions getDownloadOptions(ResolveOptions options) {
        return (DownloadOptions) new DownloadOptions().setLog(options.getLog());
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.resolve.DownloadOptions

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.