Search in sources :

Example 1 with MetadataArtifactDownloadReport

use of org.apache.ivy.core.report.MetadataArtifactDownloadReport in project ant-ivy by apache.

the class BasicResolver method getDependency.

public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
    IvyContext context = IvyContext.pushNewCopyContext();
    try {
        ResolvedModuleRevision mr = data.getCurrentResolvedModuleRevision();
        if (mr != null && shouldReturnResolvedModule(dd, mr)) {
            return mr;
        }
        if (isForce()) {
            dd = dd.clone(ModuleRevisionId.newInstance(dd.getDependencyRevisionId(), "latest.integration"));
        }
        DependencyDescriptor systemDd = dd;
        DependencyDescriptor nsDd = fromSystem(dd);
        context.setDependencyDescriptor(systemDd);
        context.setResolveData(data);
        clearIvyAttempts();
        clearArtifactAttempts();
        ModuleRevisionId systemMrid = systemDd.getDependencyRevisionId();
        ModuleRevisionId nsMrid = nsDd.getDependencyRevisionId();
        checkRevision(systemMrid);
        boolean isDynamic = getAndCheckIsDynamic(systemMrid);
        // we first search for the dependency in cache
        ResolvedModuleRevision rmr = findModuleInCache(systemDd, data);
        if (rmr != null) {
            if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this) {
                Message.verbose("\t" + getName() + ": found revision in cache: " + systemMrid + " (resolved by " + rmr.getResolver().getName() + "): but it's a default one, maybe we can find a better one");
            } else if (isForce() && rmr.getResolver() != this) {
                Message.verbose("\t" + getName() + ": found revision in cache: " + systemMrid + " (resolved by " + rmr.getResolver().getName() + "): but we are in force mode, let's try to find one ourselves");
            } else {
                Message.verbose("\t" + getName() + ": revision in cache: " + systemMrid);
                return checkLatest(systemDd, checkForcedResolvedModuleRevision(rmr), data);
            }
        }
        if (data.getOptions().isUseCacheOnly()) {
            throw new UnresolvedDependencyException("\t" + getName() + " (useCacheOnly) : no ivy file found for " + systemMrid, false);
        }
        checkInterrupted();
        ResolvedResource ivyRef = findIvyFileRef(nsDd, data);
        checkInterrupted();
        // get module descriptor
        ModuleDescriptor nsMd;
        ModuleDescriptor systemMd = null;
        if (ivyRef == null) {
            if (!isAllownomd()) {
                throw new UnresolvedDependencyException("\t" + getName() + ": no ivy file found for " + systemMrid, false);
            }
            nsMd = DefaultModuleDescriptor.newDefaultInstance(nsMrid, nsDd.getAllDependencyArtifacts());
            ResolvedResource artifactRef = findFirstArtifactRef(nsMd, nsDd, data);
            checkInterrupted();
            if (artifactRef == null) {
                throw new UnresolvedDependencyException("\t" + getName() + ": no ivy file nor artifact found for " + systemMrid, false);
            }
            long lastModified = artifactRef.getLastModified();
            if (lastModified != 0 && nsMd instanceof DefaultModuleDescriptor) {
                ((DefaultModuleDescriptor) nsMd).setLastModified(lastModified);
            }
            Message.verbose("\t" + getName() + ": no ivy file found for " + systemMrid + ": using default data");
            if (isDynamic) {
                nsMd.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(nsMrid, artifactRef.getRevision()));
            }
            systemMd = toSystem(nsMd);
            MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(systemMd.getMetadataArtifact());
            madr.setDownloadStatus(DownloadStatus.NO);
            madr.setSearched(true);
            rmr = new ResolvedModuleRevision(this, this, systemMd, madr, isForce());
            getRepositoryCacheManager().cacheModuleDescriptor(this, artifactRef, toSystem(dd), systemMd.getAllArtifacts()[0], null, getCacheOptions(data));
        } else {
            if (ivyRef instanceof MDResolvedResource) {
                rmr = ((MDResolvedResource) ivyRef).getResolvedModuleRevision();
            }
            if (rmr == null) {
                rmr = parse(ivyRef, systemDd, data);
                if (rmr == null) {
                    throw new UnresolvedDependencyException();
                }
            }
            if (!rmr.getReport().isDownloaded() && rmr.getReport().getLocalFile() != null) {
                return checkLatest(systemDd, checkForcedResolvedModuleRevision(rmr), data);
            }
            nsMd = rmr.getDescriptor();
            // check descriptor data is in sync with resource revision and names
            systemMd = toSystem(nsMd);
            if (isCheckconsistency()) {
                checkDescriptorConsistency(systemMrid, systemMd, ivyRef);
                checkDescriptorConsistency(nsMrid, nsMd, ivyRef);
            } else {
                if (systemMd instanceof DefaultModuleDescriptor) {
                    DefaultModuleDescriptor defaultMd = (DefaultModuleDescriptor) systemMd;
                    ModuleRevisionId revision = getRevision(ivyRef, systemMrid, systemMd);
                    defaultMd.setModuleRevisionId(revision);
                    defaultMd.setResolvedModuleRevisionId(revision);
                } else {
                    Message.warn("consistency disabled with instance of non DefaultModuleDescriptor... module info can't be updated, so consistency check will be done");
                    checkDescriptorConsistency(nsMrid, nsMd, ivyRef);
                    checkDescriptorConsistency(systemMrid, systemMd, ivyRef);
                }
            }
            rmr = new ResolvedModuleRevision(this, this, systemMd, toSystem(rmr.getReport()), isForce());
        }
        resolveAndCheckRevision(systemMd, systemMrid, ivyRef, isDynamic);
        resolveAndCheckPublicationDate(systemDd, systemMd, systemMrid, data);
        checkNotConvertedExclusionRule(systemMd, ivyRef, data);
        if (ivyRef == null || ivyRef.getResource() != null) {
            cacheModuleDescriptor(systemMd, systemMrid, ivyRef, rmr);
        }
        return checkLatest(systemDd, checkForcedResolvedModuleRevision(rmr), data);
    } catch (UnresolvedDependencyException ex) {
        if (!ex.getMessage().isEmpty()) {
            if (ex.isError()) {
                Message.error(ex.getMessage());
            } else {
                Message.verbose(ex.getMessage());
            }
        }
        return data.getCurrentResolvedModuleRevision();
    } finally {
        IvyContext.popContext();
    }
}
Also used : DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ResolvedResource(org.apache.ivy.plugins.resolver.util.ResolvedResource) MDResolvedResource(org.apache.ivy.plugins.resolver.util.MDResolvedResource) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) IvyContext(org.apache.ivy.core.IvyContext) ResolvedModuleRevision(org.apache.ivy.core.resolve.ResolvedModuleRevision) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) MDResolvedResource(org.apache.ivy.plugins.resolver.util.MDResolvedResource)

Example 2 with MetadataArtifactDownloadReport

use of org.apache.ivy.core.report.MetadataArtifactDownloadReport in project ant-ivy by apache.

the class BasicResolver method getDefaultRMDParser.

protected ResourceMDParser getDefaultRMDParser(final ModuleId mid) {
    return new ResourceMDParser() {

        public MDResolvedResource parse(Resource resource, String rev) {
            DefaultModuleDescriptor md = DefaultModuleDescriptor.newDefaultInstance(new ModuleRevisionId(mid, rev));
            MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(md.getMetadataArtifact());
            madr.setDownloadStatus(DownloadStatus.NO);
            madr.setSearched(true);
            return new MDResolvedResource(resource, rev, new ResolvedModuleRevision(BasicResolver.this, BasicResolver.this, md, madr, isForce()));
        }
    };
}
Also used : MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ResourceMDParser(org.apache.ivy.plugins.resolver.util.ResourceMDParser) ResolvedResource(org.apache.ivy.plugins.resolver.util.ResolvedResource) MDResolvedResource(org.apache.ivy.plugins.resolver.util.MDResolvedResource) Resource(org.apache.ivy.plugins.repository.Resource) FileResource(org.apache.ivy.plugins.repository.file.FileResource) URLResource(org.apache.ivy.plugins.repository.url.URLResource) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) ResolvedModuleRevision(org.apache.ivy.core.resolve.ResolvedModuleRevision) DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) MDResolvedResource(org.apache.ivy.plugins.resolver.util.MDResolvedResource)

Example 3 with MetadataArtifactDownloadReport

use of org.apache.ivy.core.report.MetadataArtifactDownloadReport in project ant-ivy by apache.

the class AbstractWorkspaceResolver method checkCandidate.

protected ResolvedModuleRevision checkCandidate(DependencyDescriptor dd, ModuleDescriptor md, String workspaceModuleName) {
    if (workspaceModuleName == null) {
        workspaceModuleName = dd.getDependencyId().toString();
    }
    ModuleRevisionId dependencyMrid = dd.getDependencyRevisionId();
    String org = dependencyMrid.getModuleId().getOrganisation();
    String module = dependencyMrid.getModuleId().getName();
    VersionMatcher versionMatcher = getSettings().getVersionMatcher();
    ModuleRevisionId candidateMrid = md.getModuleRevisionId();
    switch(org) {
        case BundleInfo.BUNDLE_TYPE:
            // looking for an OSGi bundle via its symbolic name
            String sn = md.getExtraInfoContentByTagName("Bundle-SymbolicName");
            if (sn == null || !module.equals(sn)) {
                // not found, skip to next
                return null;
            }
            break;
        case BundleInfo.PACKAGE_TYPE:
            // looking for an OSGi bundle via its exported package
            String exportedPackages = md.getExtraInfoContentByTagName("Export-Package");
            if (exportedPackages == null) {
                // not found, skip to next
                return null;
            }
            boolean found = false;
            String version = null;
            ManifestHeaderValue exportElements;
            try {
                exportElements = new ManifestHeaderValue(exportedPackages);
            } catch (ParseException e) {
                // wrong OSGi header: skip it
                return null;
            }
            for (ManifestHeaderElement exportElement : exportElements.getElements()) {
                if (exportElement.getValues().contains(module)) {
                    found = true;
                    version = exportElement.getAttributes().get("version");
                    break;
                }
            }
            if (!found) {
                // not found, skip to next
                return null;
            }
            if (version == null) {
                // no version means anything can match. Let's trick the version matcher by
                // setting the exact expected version
                version = dependencyMrid.getRevision();
            }
            md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(org, module, version));
            break;
        default:
            if (!candidateMrid.getModuleId().equals(dependencyMrid.getModuleId())) {
                // it doesn't match org#module, skip to next
                return null;
            }
            break;
    }
    Message.verbose("Workspace resolver found potential matching workspace module " + workspaceModuleName + " with module " + candidateMrid + " for module " + dependencyMrid);
    if (!ignoreBranch) {
        ModuleId mid = dependencyMrid.getModuleId();
        String defaultBranch = getSettings().getDefaultBranch(mid);
        String dependencyBranch = dependencyMrid.getBranch();
        String candidateBranch = candidateMrid.getBranch();
        if (dependencyBranch == null) {
            dependencyBranch = defaultBranch;
        }
        if (candidateBranch == null) {
            candidateBranch = defaultBranch;
        }
        if (dependencyBranch != candidateBranch) {
            // Both cannot be null
            if (dependencyBranch == null || candidateBranch == null) {
                Message.verbose("\t\trejected since branches doesn't match (one is set, the other isn't)");
                return null;
            }
            if (!dependencyBranch.equals(candidateBranch)) {
                Message.verbose("\t\trejected since branches doesn't match");
                return null;
            }
        }
    }
    // Found one; check if it is for the module we need
    if (!ignoreVersion && !md.getModuleRevisionId().getRevision().equals(Ivy.getWorkingRevision()) && !versionMatcher.accept(dd.getDependencyRevisionId(), md)) {
        Message.verbose("\t\treject as version didn't match");
        return null;
    }
    if (ignoreVersion) {
        Message.verbose("\t\tmatched (version are ignored)");
    } else {
        Message.verbose("\t\tversion matched");
    }
    WorkspaceModuleDescriptor workspaceMd = createWorkspaceMd(md);
    Artifact mdaf = md.getMetadataArtifact();
    if (mdaf == null) {
        mdaf = new DefaultArtifact(md.getModuleRevisionId(), md.getPublicationDate(), workspaceModuleName, "ivy", "");
    }
    MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(mdaf);
    madr.setDownloadStatus(DownloadStatus.SUCCESSFUL);
    madr.setSearched(true);
    return new ResolvedModuleRevision(this, this, workspaceMd, madr);
}
Also used : MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ManifestHeaderValue(org.apache.ivy.osgi.core.ManifestHeaderValue) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) ResolvedModuleRevision(org.apache.ivy.core.resolve.ResolvedModuleRevision) Artifact(org.apache.ivy.core.module.descriptor.Artifact) DefaultArtifact(org.apache.ivy.core.module.descriptor.DefaultArtifact) DefaultWorkspaceModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultWorkspaceModuleDescriptor) WorkspaceModuleDescriptor(org.apache.ivy.core.module.descriptor.WorkspaceModuleDescriptor) ModuleId(org.apache.ivy.core.module.id.ModuleId) ManifestHeaderElement(org.apache.ivy.osgi.core.ManifestHeaderElement) VersionMatcher(org.apache.ivy.plugins.version.VersionMatcher) ParseException(java.text.ParseException) DefaultArtifact(org.apache.ivy.core.module.descriptor.DefaultArtifact)

Example 4 with MetadataArtifactDownloadReport

use of org.apache.ivy.core.report.MetadataArtifactDownloadReport in project ant-ivy by apache.

the class DefaultRepositoryCacheManager method doFindModuleInCache.

private ResolvedModuleRevision doFindModuleInCache(ModuleRevisionId mrid, CacheMetadataOptions options, String expectedResolver) {
    if (!lockMetadataArtifact(mrid)) {
        Message.error("impossible to acquire lock for " + mrid);
        return null;
    }
    boolean unlock = true;
    try {
        if (settings.getVersionMatcher().isDynamic(mrid)) {
            String resolvedRevision = getResolvedRevision(expectedResolver, mrid, options);
            if (resolvedRevision == null) {
                return null;
            }
            Message.verbose("found resolved revision in cache: " + mrid + " => " + resolvedRevision);
            // we have found another module in the cache, make sure we unlock
            // the original module
            unlockMetadataArtifact(mrid);
            mrid = ModuleRevisionId.newInstance(mrid, resolvedRevision);
            // don't forget to request a lock on the new module!
            if (!lockMetadataArtifact(mrid)) {
                Message.error("impossible to acquire lock for " + mrid);
                // we couldn't lock the new module, so no need to unlock it
                unlock = false;
                return null;
            }
        }
        File ivyFile = getIvyFileInCache(mrid);
        if (ivyFile.exists()) {
            // found in cache !
            try {
                ModuleDescriptorParser parser = getModuleDescriptorParser(ivyFile);
                ModuleDescriptor depMD = getMdFromCache(parser, options, ivyFile);
                String resolverName = getSavedResolverName(depMD);
                String artResolverName = getSavedArtResolverName(depMD);
                DependencyResolver resolver = settings.getResolver(resolverName);
                if (resolver == null) {
                    Message.debug("\tresolver not found: " + resolverName + " => trying to use the one configured for " + mrid);
                    resolver = settings.getResolver(depMD.getResolvedModuleRevisionId());
                    if (resolver != null) {
                        Message.debug("\tconfigured resolver found for " + depMD.getResolvedModuleRevisionId() + ": " + resolver.getName() + ": saving this data");
                        saveResolver(depMD, resolver.getName());
                    }
                }
                DependencyResolver artResolver = settings.getResolver(artResolverName);
                if (artResolver == null) {
                    artResolver = resolver;
                }
                if (resolver != null) {
                    Message.debug("\tfound ivy file in cache for " + mrid + " (resolved by " + resolver.getName() + "): " + ivyFile);
                    if (expectedResolver == null || expectedResolver.equals(resolver.getName())) {
                        MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(depMD.getMetadataArtifact());
                        madr.setDownloadStatus(DownloadStatus.NO);
                        madr.setSearched(false);
                        madr.setLocalFile(ivyFile);
                        madr.setSize(ivyFile.length());
                        madr.setArtifactOrigin(getSavedArtifactOrigin(depMD.getMetadataArtifact()));
                        if (madr.getArtifactOrigin().isExists()) {
                            if (madr.getArtifactOrigin().isLocal() && madr.getArtifactOrigin().getArtifact().getUrl() != null) {
                                madr.setOriginalLocalFile(new File(madr.getArtifactOrigin().getArtifact().getUrl().toURI()));
                            } else {
                                // find locally cached file
                                madr.setOriginalLocalFile(getArchiveFileInCache(madr.getArtifactOrigin().getArtifact()));
                            }
                        }
                        return new ResolvedModuleRevision(resolver, artResolver, depMD, madr);
                    }
                    Message.debug("found module in cache but with a different resolver: " + "discarding: " + mrid + "; expected resolver=" + expectedResolver + "; resolver=" + resolver.getName());
                } else {
                    Message.debug("\tresolver not found: " + resolverName + " => cannot use cached ivy file for " + mrid);
                }
            } catch (Exception e) {
                // will try with resolver
                Message.debug("\tproblem while parsing cached ivy file for: " + mrid, e);
            }
        } else {
            Message.debug("\tno ivy file in cache for " + mrid + ": tried " + ivyFile);
        }
    } finally {
        if (unlock) {
            unlockMetadataArtifact(mrid);
        }
    }
    return null;
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ResolvedModuleRevision(org.apache.ivy.core.resolve.ResolvedModuleRevision) PropertiesFile(org.apache.ivy.util.PropertiesFile) File(java.io.File) ModuleDescriptorParser(org.apache.ivy.plugins.parser.ModuleDescriptorParser) XmlModuleDescriptorParser(org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser) ParseException(java.text.ParseException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver)

Example 5 with MetadataArtifactDownloadReport

use of org.apache.ivy.core.report.MetadataArtifactDownloadReport in project ant-ivy by apache.

the class InstallEngine method install.

public ResolveReport install(ModuleRevisionId mrid, String from, String to, InstallOptions options) throws IOException {
    DependencyResolver fromResolver = settings.getResolver(from);
    DependencyResolver toResolver = settings.getResolver(to);
    if (fromResolver == null) {
        throw new IllegalArgumentException("unknown resolver " + from + ". Available resolvers are: " + settings.getResolverNames());
    }
    if (toResolver == null) {
        throw new IllegalArgumentException("unknown resolver " + to + ". Available resolvers are: " + settings.getResolverNames());
    }
    PatternMatcher matcher = settings.getMatcher(options.getMatcherName());
    if (matcher == null) {
        throw new IllegalArgumentException("unknown matcher " + options.getMatcherName() + ". Available matchers are: " + settings.getMatcherNames());
    }
    // build module file declaring the dependency
    Message.info(":: installing " + mrid + " ::");
    DependencyResolver oldDictator = resolveEngine.getDictatorResolver();
    boolean log = settings.logNotConvertedExclusionRule();
    try {
        settings.setLogNotConvertedExclusionRule(true);
        resolveEngine.setDictatorResolver(fromResolver);
        DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("apache", "ivy-install", "1.0"), settings.getStatusManager().getDefaultStatus(), new Date());
        String resolveId = ResolveOptions.getDefaultResolveId(md);
        md.addConfiguration(new Configuration("default"));
        md.addConflictManager(new ModuleId(ExactPatternMatcher.ANY_EXPRESSION, ExactPatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE, new NoConflictManager());
        for (String dc : options.getConfs()) {
            final String depConf = dc.trim();
            if (MatcherHelper.isExact(matcher, mrid)) {
                DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, false, false, options.isTransitive());
                dd.addDependencyConfiguration("default", depConf);
                md.addDependency(dd);
            } else {
                for (ModuleRevisionId imrid : searchEngine.listModules(fromResolver, mrid, matcher)) {
                    Message.info("\tfound " + imrid + " to install: adding to the list");
                    DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, imrid, false, false, options.isTransitive());
                    dd.addDependencyConfiguration("default", depConf);
                    md.addDependency(dd);
                }
            }
        }
        // resolve using appropriate resolver
        ResolveReport report = new ResolveReport(md, resolveId);
        Message.info(":: resolving dependencies ::");
        ResolveOptions resolveOptions = new ResolveOptions().setResolveId(resolveId).setConfs(new String[] { "default" }).setValidate(options.isValidate());
        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 (IvyNode dependency : dependencies) {
            ModuleDescriptor depmd = dependency.getDescriptor();
            if (depmd != null) {
                ModuleRevisionId depMrid = depmd.getModuleRevisionId();
                Message.verbose("installing " + depMrid);
                boolean successfullyPublished = false;
                try {
                    toResolver.beginPublishTransaction(depMrid, options.isOverwrite());
                    // publish artifacts
                    for (ArtifactDownloadReport artifact : report.getArtifactsReports(depMrid)) {
                        if (artifact.getLocalFile() != null) {
                            toResolver.publish(artifact.getArtifact(), artifact.getLocalFile(), options.isOverwrite());
                        }
                    }
                    // publish metadata
                    MetadataArtifactDownloadReport artifactDownloadReport = dependency.getModuleRevision().getReport();
                    File localIvyFile = artifactDownloadReport.getLocalFile();
                    toResolver.publish(depmd.getMetadataArtifact(), localIvyFile, options.isOverwrite());
                    if (options.isInstallOriginalMetadata()) {
                        if (artifactDownloadReport.getArtifactOrigin() != null && artifactDownloadReport.getArtifactOrigin().isExists() && !ArtifactOrigin.isUnknown(artifactDownloadReport.getArtifactOrigin()) && artifactDownloadReport.getArtifactOrigin().getArtifact() != null && artifactDownloadReport.getArtifactOrigin().getArtifact().getType().endsWith(".original") && !artifactDownloadReport.getArtifactOrigin().getArtifact().getType().equals(depmd.getMetadataArtifact().getType() + ".original")) {
                            // publish original metadata artifact, too, as it has a different
                            // type
                            toResolver.publish(artifactDownloadReport.getArtifactOrigin().getArtifact(), artifactDownloadReport.getOriginalLocalFile(), options.isOverwrite());
                        }
                    }
                    // end module publish
                    toResolver.commitPublishTransaction();
                    successfullyPublished = true;
                } finally {
                    if (!successfullyPublished) {
                        toResolver.abortPublishTransaction();
                    }
                }
            }
        }
        Message.info(":: install resolution report ::");
        // output report
        resolveEngine.outputReport(report, settings.getResolutionCacheManager(), resolveOptions);
        return report;
    } finally {
        // IVY-834: log the problems if there were any...
        Message.sumupProblems();
        resolveEngine.setDictatorResolver(oldDictator);
        settings.setLogNotConvertedExclusionRule(log);
    }
}
Also used : MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) Configuration(org.apache.ivy.core.module.descriptor.Configuration) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ArtifactDownloadReport(org.apache.ivy.core.report.ArtifactDownloadReport) Date(java.util.Date) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) ModuleId(org.apache.ivy.core.module.id.ModuleId) DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) NoConflictManager(org.apache.ivy.plugins.conflict.NoConflictManager) ResolveReport(org.apache.ivy.core.report.ResolveReport) DownloadOptions(org.apache.ivy.core.resolve.DownloadOptions) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor) DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) ExactPatternMatcher(org.apache.ivy.plugins.matcher.ExactPatternMatcher) PatternMatcher(org.apache.ivy.plugins.matcher.PatternMatcher) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) File(java.io.File) IvyNode(org.apache.ivy.core.resolve.IvyNode)

Aggregations

MetadataArtifactDownloadReport (org.apache.ivy.core.report.MetadataArtifactDownloadReport)11 ResolvedModuleRevision (org.apache.ivy.core.resolve.ResolvedModuleRevision)8 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)6 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)6 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)5 MDResolvedResource (org.apache.ivy.plugins.resolver.util.MDResolvedResource)4 File (java.io.File)3 Date (java.util.Date)3 ResolvedResource (org.apache.ivy.plugins.resolver.util.ResolvedResource)3 IOException (java.io.IOException)2 ParseException (java.text.ParseException)2 Artifact (org.apache.ivy.core.module.descriptor.Artifact)2 Configuration (org.apache.ivy.core.module.descriptor.Configuration)2 DefaultArtifact (org.apache.ivy.core.module.descriptor.DefaultArtifact)2 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)2 ModuleId (org.apache.ivy.core.module.id.ModuleId)2 ArtifactDownloadReport (org.apache.ivy.core.report.ArtifactDownloadReport)2 ModuleDescriptorParser (org.apache.ivy.plugins.parser.ModuleDescriptorParser)2 XmlModuleDescriptorParser (org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser)2 DependencyResolver (org.apache.ivy.plugins.resolver.DependencyResolver)2