Пример #1
0
 public ArtifactOrigin locate(Artifact artifact) {
   ArtifactOrigin origin = getRepositoryCacheManager().getSavedArtifactOrigin(toSystem(artifact));
   if (!ArtifactOrigin.isUnknown(origin)) {
     return origin;
   }
   ResolvedResource artifactRef = getArtifactRef(artifact, null);
   if (artifactRef != null && artifactRef.getResource().exists()) {
     return new ArtifactOrigin(
         artifact, artifactRef.getResource().isLocal(), artifactRef.getResource().getName());
   }
   return null;
 }
Пример #2
0
 public ArtifactDownloadReport download(final ArtifactOrigin origin, DownloadOptions options) {
   Checks.checkNotNull(origin, "origin");
   return getRepositoryCacheManager()
       .download(
           origin.getArtifact(),
           new ArtifactResourceResolver() {
             public ResolvedResource resolve(Artifact artifact) {
               try {
                 Resource resource = getResource(origin.getLocation());
                 if (resource == null) {
                   return null;
                 }
                 String revision = origin.getArtifact().getModuleRevisionId().getRevision();
                 return new ResolvedResource(resource, revision);
               } catch (IOException e) {
                 Message.debug(e);
                 return null;
               }
             }
           },
           downloader,
           getCacheDownloadOptions(options));
 }
 public boolean artifactExists(Artifact artifact) {
   return !ArtifactOrigin.isUnknown(moduleResolver.locate(artifact));
 }