Java Code Examples for org.apache.maven.artifact.repository.Authentication#getPassword()
The following examples show how to use
org.apache.maven.artifact.repository.Authentication#getPassword() .
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 wildfly-swarm with Apache License 2.0 | 6 votes |
protected static RemoteRepository buildRemoteRepository(final String id, final String url, final Authentication auth, final Proxy proxy) { RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url); if (auth != null && auth.getUsername() != null && auth.getPassword() != null) { builder.setAuthentication(new AuthenticationBuilder() .addUsername(auth.getUsername()) .addPassword(auth.getPassword()).build()); } if (proxy != null) { builder.setProxy(proxy); } return builder.build(); }
Example 2
Source File: MavenArtifactResolvingHelper.java From thorntail with Apache License 2.0 | 5 votes |
private RemoteRepository buildRemoteRepository(final String id, final String url, final Authentication auth, final ArtifactRepositoryPolicy releasesPolicy, final ArtifactRepositoryPolicy snapshotsPolicy) { RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url); if (auth != null && auth.getUsername() != null && auth.getPassword() != null) { builder.setAuthentication(new AuthenticationBuilder() .addUsername(auth.getUsername()) .addPassword(auth.getPassword()).build()); } builder.setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy())); builder.setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy())); RemoteRepository repository = builder.build(); final RemoteRepository mirror = session.getMirrorSelector().getMirror(repository); if (mirror != null) { final org.eclipse.aether.repository.Authentication mirrorAuth = session.getAuthenticationSelector() .getAuthentication(mirror); RemoteRepository.Builder mirrorBuilder = new RemoteRepository.Builder(mirror) .setId(repository.getId()) .setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy())) .setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy())); if (mirrorAuth != null) { mirrorBuilder.setAuthentication(mirrorAuth); } repository = mirrorBuilder.build(); } Proxy proxy = session.getProxySelector().getProxy(repository); if (proxy != null) { repository = new RemoteRepository.Builder(repository).setProxy(proxy).build(); } return repository; }
Example 3
Source File: MavenArtifactResolvingHelper.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 5 votes |
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()); }