public Authentication getAuthentication() { Authentication auth = null; if (this.username != null && this.password != null) { auth = new Authentication(this.username, this.password); } return auth; }
public Proxy getProxy() { if (isNotBlank(proxyHost) && proxyPort != null) { if (isNotBlank(proxyLogin)) { return new Proxy(proxyProtocol, proxyHost, proxyPort, new Authentication(proxyLogin, proxyPassword)); } else { return new Proxy(proxyProtocol, proxyHost, proxyPort, null); } } return null; }
public void setProxy(URL proxyUrl, String proxyUser, String proxyPassword) { Authentication auth = new Authentication(proxyUser, proxyPassword); Proxy proxy = new Proxy(proxyUrl.getProtocol(), proxyUrl.getHost(), proxyUrl.getPort(), auth); synchronized (repos) { for (RemoteRepository repo : repos) { repo.setProxy(proxy); } } }
public void addRepo(String id, String url, boolean snapshot, Authentication auth, Proxy proxy) { synchronized (repos) { delRepo(id); RemoteRepository rr = new RemoteRepository(id, "default", url); rr.setPolicy(snapshot, new RepositoryPolicy( true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN)); rr.setAuthentication(auth); rr.setProxy(proxy); repos.add(rr); } }
public void addRepo(String id, String url, boolean snapshot) { synchronized (repos) { delRepo(id); RemoteRepository rr = new RemoteRepository(id, "default", url); rr.setPolicy(snapshot, new RepositoryPolicy( true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN)); repos.add(rr); } }
private List<ArtifactResult> fetchArtifactWithDep(Dependency dep) throws DependencyResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(dep.getGroupArtifactVersion()); DependencyFilter classpathFilter = DependencyFilterUtils .classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter( dep.getExclusions()); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new org.sonatype.aether.graph.Dependency(artifact, JavaScopes.COMPILE)); collectRequest.addRepository(mavenCentral); collectRequest.addRepository(mavenLocal); for (Repository repo : repositories) { RemoteRepository rr = new RemoteRepository(repo.getId(), "default", repo.getUrl()); rr.setPolicy(repo.isSnapshot(), null); collectRequest.addRepository(rr); } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); }
public static RemoteRepository newLocalRepository() { return new RemoteRepository("local", "default", "file://" + System.getProperty("user.home") + "/.m2/repository"); } }
public static RepositorySystemSession newRepositorySystemSession( RepositorySystem system, String localRepoPath) { Validate.notNull(localRepoPath, "localRepoPath should have a value"); MavenRepositorySystemSession session = new MavenRepositorySystemSession(); LocalRepository localRepo = new LocalRepository(resolveLocalRepoPath(localRepoPath)); session.setLocalRepositoryManager(system.newLocalRepositoryManager(localRepo)); if (logger.isDebugEnabled()) { session.setTransferListener(new TransferListener()); session.setRepositoryListener(new RepositoryListener()); } // uncomment to generate dirty trees // session.setDependencyGraphTransformer( null ); return session; }
public Authentication getAuthentication( RemoteRepository repository ) { Authentication auth = repository.getAuthentication(); if ( auth != null ) { return auth; } return selector.getAuthentication( repository ); }
public RemoteRepository delRepo(String id) { synchronized (repos) { Iterator<RemoteRepository> it = repos.iterator(); while (it.hasNext()) { RemoteRepository repo = it.next(); if (repo.getId().equals(id)) { it.remove(); return repo; } } } return null; }
private File getLocalFile( RepositorySystemSession session, Metadata metadata ) { LocalRepositoryManager lrm = session.getLocalRepositoryManager(); LocalMetadataResult localResult = lrm.find( session, new LocalMetadataRequest( metadata, null, null ) ); File localFile = localResult.getFile(); return localFile; }
/** * Creates a registration request for the specified (locally installed) artifact. * * @param artifact The artifact to register, may be {@code null}. */ public LocalArtifactRegistration( Artifact artifact ) { setArtifact( artifact ); }
/** * Gets the passphrase for the private key. * * @return The passphrase for the private key or {@code null} if none. */ public String getPassphrase() { return toStr( passphrase ); }
public static RemoteRepository newCentralRepository() { String mvnRepo = System.getenv("ZEPPELIN_INTERPRETER_DEP_MVNREPO"); if (mvnRepo == null) { mvnRepo = System.getProperty("zeppelin.interpreter.dep.mvnRepo"); } if (mvnRepo == null) { mvnRepo = "http://repo1.maven.org/maven2/"; } return new RemoteRepository("central", "default", mvnRepo); }
private File getLocalFile( RepositorySystemSession session, Metadata metadata ) { LocalRepositoryManager lrm = session.getLocalRepositoryManager(); LocalMetadataResult localResult = lrm.find( session, new LocalMetadataRequest( metadata, null, null ) ); File localFile = localResult.getFile(); return localFile; }