Java Code Examples for org.apache.maven.artifact.repository.ArtifactRepository#getUrl()

The following examples show how to use org.apache.maven.artifact.repository.ArtifactRepository#getUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenArtifactResolvingHelper.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
public void remoteRepository(ArtifactRepository repo) {
    RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.getId(), "default", repo.getUrl());
    final Authentication mavenAuth = repo.getAuthentication();
    if (mavenAuth != null && mavenAuth.getUsername() != null && mavenAuth.getPassword() != null) {
        builder.setAuthentication(new AuthenticationBuilder()
                .addUsername(mavenAuth.getUsername())
                .addPassword(mavenAuth.getPassword()).build());
    }
    this.remoteRepositories.add(builder.build());
}
 
Example 2
Source File: AetherUtils.java    From takari-lifecycle with Eclipse Public License 1.0 5 votes vote down vote up
public static RemoteRepository toRepo(ArtifactRepository repo) {
  RemoteRepository result = null;
  if (repo != null) {
    RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.getId(), getLayout(repo), repo.getUrl());
    builder.setSnapshotPolicy(toPolicy(repo.getSnapshots()));
    builder.setReleasePolicy(toPolicy(repo.getReleases()));
    builder.setAuthentication(toAuthentication(repo.getAuthentication()));
    builder.setProxy(toProxy(repo.getProxy()));
    builder.setMirroredRepositories(toRepos(repo.getMirroredRepositories()));
    result = builder.build();
  }
  return result;
}
 
Example 3
Source File: MavenLocationExpander.java    From pom-manipulation-ext with Apache License 2.0 4 votes vote down vote up
private void addRequestRepositoriesTo( final Set<Location> locs,
                                       final List<ArtifactRepository> artifactRepositories,
                                       final Settings settings, final MirrorSelector mirrorSelector )
    throws MalformedURLException
{
    if ( artifactRepositories != null )
    {
        for ( final ArtifactRepository repo : artifactRepositories )
        {
            // TODO: Authentication via memory password manager.
            String id = repo.getId();
            String url = repo.getUrl();

            if ( url.startsWith( "file:" ) )
            {
                locs.add( new SimpleLocation( id, url ) );
            }
            else
            {
                final List<Mirror> mirrors = settings.getMirrors();
                if ( mirrors != null )
                {
                    final Mirror mirror = mirrorSelector == null ? null : mirrorSelector.getMirror( repo, mirrors );
                    if ( mirror != null )
                    {
                        id = mirror.getId();
                        url = mirror.getUrl();
                    }
                }

                final ArtifactRepositoryPolicy releases = repo.getReleases();
                final ArtifactRepositoryPolicy snapshots = repo.getSnapshots();

                SimpleHttpLocation addition = new SimpleHttpLocation( id, url,
                                                                      snapshots != null && snapshots.isEnabled(),
                                                                      releases == null || releases.isEnabled(), true, false,
                                                                      null );

                addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60);

                locs.add (addition);
            }
        }
    }
}