Package org.moxie

Examples of org.moxie.MavenCache


  }
 
  public IMavenCache getMavenCache(File file) {
    String path = FileUtils.getRelativePath(moxieRoot, file);
    File folder = getArtifactRoot(path);
    return new MavenCache(folder);
  }
View Full Code Here


  public IMavenCache getMavenCache(String repository) {
    for (String repo : localRepositories) {
      if (repo.equalsIgnoreCase(repository)) {
        File file = new File(localArtifactsRoot, repo);
        return new MavenCache(file);
      }
    }
    if (remoteRepositoryLookup.containsKey(repository)) {
      RemoteRepository repo = remoteRepositoryLookup.get(repository);
      String folder = StringUtils.urlToFolder(repo.url);
      File file = new File(remoteArtifactsRoot, folder);
      return new MavenCache(file);
    }
    return null;
  }
View Full Code Here

  public DependencyLink find(Dependency dependency) {
    String path = null;
    for (String repository : localRepositories) {
      File cacheRoot = new File(localArtifactsRoot, repository);
      IMavenCache cache = new MavenCache(cacheRoot);
      File file = cache.getArtifact(dependency, dependency.extension);
      if (file != null && file.exists()) {       
        path = repository + "/" + FileUtils.getRelativePath(cacheRoot, file.getParentFile());
      }
    }
   
    for (RemoteRepository repository : remoteRepositories) {
      String folder = StringUtils.urlToFolder(repository.url);
      File cacheRoot = new File(remoteArtifactsRoot, folder);
      IMavenCache cache = new MavenCache(cacheRoot);
      File file = cache.getArtifact(dependency, dependency.extension);
      if (file != null && file.exists()) {
        path = repository.id + "/" + FileUtils.getRelativePath(cacheRoot, file.getParentFile());
      }
    }
    if (StringUtils.isEmpty(path)) {
View Full Code Here

        String url = repository.getRepositoryUrl();
        if (url.startsWith("file:/")) {         
          try {
            URI uri = new URI(url);
            baseDir = new File(uri);
            cache = new MavenCache(baseDir);           
          } catch (URISyntaxException e) {
            throw new MoxieException("Failed to parse " + url, e);
          }
        } else {
          throw new MoxieException("Invalid url \"{0}\"! Moxie does not support installing or deploying artifacts to remote repositories!", url);
        }
      }     
    } else {
      // return MavenCache for specified directory
      cache = new MavenCache(baseDir);
    }   
    return cache;
  }
View Full Code Here

  }

  @Test
  public void generateMoxieMavenIndex() {
    String template = readResource("maven/artifact.json");
    IMavenCache cache = new MavenCache(new File("../maven"));
    String index = cache.generatePomIndex(template.trim(), ",\n");
    StringBuilder sb = new StringBuilder();
    sb.append("[\n");
    sb.append(index);
    sb.append("]\n");
    FileUtils.writeContent(new File("../maven/artifacts.json"), sb.toString());
View Full Code Here

    FileUtils.writeContent(new File("../maven/artifacts.json"), sb.toString());
  }
 
  @Test
  public void generatePrefixesIndex() {
    IMavenCache cache = new MavenCache(new File("../maven"));
    File index = cache.updatePrefixesIndex();
    assertTrue(index.exists());
  }
View Full Code Here

TOP

Related Classes of org.moxie.MavenCache

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.