Search in sources :

Example 11 with DownloadOptions

use of org.apache.ivy.core.resolve.DownloadOptions in project ant-ivy by apache.

the class AbstractResolver method locate.

/**
 * Default implementation actually download the artifact Subclasses should overwrite this to
 * avoid the download
 *
 * @param artifact ArtifactOrigin
 * @return ArtifactOrigin
 */
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
             */
        throw new IllegalStateException("null download report returned by " + getName() + " (" + getClass().getName() + ")" + " when trying to download " + artifact);
    }
    ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
    return adr.getDownloadStatus() == DownloadStatus.FAILED ? null : adr.getArtifactOrigin();
}
Also used : DownloadReport(org.apache.ivy.core.report.DownloadReport) MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ArtifactDownloadReport(org.apache.ivy.core.report.ArtifactDownloadReport) DownloadOptions(org.apache.ivy.core.resolve.DownloadOptions) CacheDownloadOptions(org.apache.ivy.core.cache.CacheDownloadOptions) MetadataArtifactDownloadReport(org.apache.ivy.core.report.MetadataArtifactDownloadReport) ArtifactDownloadReport(org.apache.ivy.core.report.ArtifactDownloadReport)

Aggregations

DownloadOptions (org.apache.ivy.core.resolve.DownloadOptions)11 ArtifactDownloadReport (org.apache.ivy.core.report.ArtifactDownloadReport)10 DownloadReport (org.apache.ivy.core.report.DownloadReport)10 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)9 ResolvedModuleRevision (org.apache.ivy.core.resolve.ResolvedModuleRevision)8 Artifact (org.apache.ivy.core.module.descriptor.Artifact)7 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)6 Test (org.junit.Test)6 Date (java.util.Date)3 File (java.io.File)2 DefaultArtifact (org.apache.ivy.core.module.descriptor.DefaultArtifact)2 MetadataArtifactDownloadReport (org.apache.ivy.core.report.MetadataArtifactDownloadReport)2 GregorianCalendar (java.util.GregorianCalendar)1 CacheDownloadOptions (org.apache.ivy.core.cache.CacheDownloadOptions)1 DefaultRepositoryCacheManager (org.apache.ivy.core.cache.DefaultRepositoryCacheManager)1 Configuration (org.apache.ivy.core.module.descriptor.Configuration)1 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)1 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)1 ModuleId (org.apache.ivy.core.module.id.ModuleId)1 ResolveReport (org.apache.ivy.core.report.ResolveReport)1