Esempio n. 1
0
  public static ArtifactRepository buildArtifactRepository(org.apache.maven.model.Repository repo)
      throws InvalidRepositoryException {
    if (repo != null) {
      String id = repo.getId();

      if (StringUtils.isEmpty(id)) {
        throw new InvalidRepositoryException("Repository identifier missing", "");
      }

      String url = repo.getUrl();

      if (StringUtils.isEmpty(url)) {
        throw new InvalidRepositoryException("URL missing for repository " + id, id);
      }

      ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy(repo.getSnapshots());

      ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy(repo.getReleases());

      ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();

      return createArtifactRepository(id, url, layout, snapshots, releases);
    } else {
      return null;
    }
  }
  @Override
  public void addRepository(Repository repository) throws InvalidRepositoryException {
    if (!repositoryIds.add(repository.getId())) {
      return;
    }

    this.repositories.add(ArtifactDescriptorUtils.toRemoteRepository(repository));
  }
Esempio n. 3
0
  public MavenRemoteRepository(Repository repository) {
    myId = repository.getId();
    myName = repository.getName();
    myUrl = repository.getUrl();
    myLayout = repository.getLayout();

    if (repository.getReleases() != null) myReleasesPolicy = new Policy(repository.getReleases());
    if (repository.getSnapshots() != null)
      mySnapshotsPolicy = new Policy(repository.getSnapshots());
  }