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); } }
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); } }
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(); }
/** * Creates a new repository with the specified properties and the default policies. * * @param id The identifier of the repository, may be {@code null}. * @param type The type of the repository, may be {@code null}. * @param url The (base) URL of the repository, may be {@code null}. */ public RemoteRepository( String id, String type, String url ) { setId( id ); setContentType( type ); setUrl( url ); setPolicy( true, null ); setPolicy( false, null ); }
/** * Creates a new repository with the specified properties and the default policies. * * @param id The identifier of the repository, may be {@code null}. * @param type The type of the repository, may be {@code null}. * @param url The (base) URL of the repository, may be {@code null}. */ public RemoteRepository( String id, String type, String url ) { setId( id ); setContentType( type ); setUrl( url ); setPolicy( true, null ); setPolicy( false, null ); }
/** * Creates a new repository with the specified properties and the default policies. * * @param id The identifier of the repository, may be {@code null}. * @param type The type of the repository, may be {@code null}. * @param url The (base) URL of the repository, may be {@code null}. */ public RemoteRepository( String id, String type, String url ) { setId( id ); setContentType( type ); setUrl( url ); setPolicy( true, null ); setPolicy( false, null ); }
protected List<RemoteRepository> getRemoteRepositories() { List<RemoteRepository> repos = new ArrayList<RemoteRepository>(); for( int i = 0; i < repositories.length; i++ ) { String text = repositories[i].trim(); boolean snapshot = false; while (true) { int idx = text.lastIndexOf('@'); if (idx <= 0) { break; } String postfix = text.substring(idx + 1); if (postfix.equals("snapshots")) { snapshot = true; } else if (postfix.equals("noreleases")) { // TODO } else { LOGGER.warn("Unknown postfix: @" + postfix + " on repository URL: " + text); break; } text = text.substring(0, idx); } RemoteRepository repository = new RemoteRepository("repos" + i, "default", text); RepositoryPolicy policy = new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN); repository.setPolicy(snapshot, policy); repos.add(repository); } return repos; }
private static RemoteRepository makeRemoteRepository(Metadata.Repository info, Server server, boolean snapshot) { return new RemoteRepository(info.getId(), "default", info.getUri()) .setPolicy(true, new RepositoryPolicy(snapshot, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_FAIL)) .setPolicy(false, new RepositoryPolicy(!snapshot, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_FAIL)) .setAuthentication(new Authentication(server.getUsername(), server.getPassword())); }
public RemoteRepository getMirror( RemoteRepository repository ) { MirrorDef mirror = findMirror( repository ); if ( mirror == null ) { return null; } RemoteRepository repo = new RemoteRepository(); repo.setRepositoryManager( mirror.repositoryManager ); repo.setId( mirror.id ); repo.setUrl( mirror.url ); if ( mirror.type != null && mirror.type.length() > 0 ) { repo.setContentType( mirror.type ); } else { repo.setContentType( repository.getContentType() ); } repo.setPolicy( true, repository.getPolicy( true ) ); repo.setPolicy( false, repository.getPolicy( false ) ); repo.setMirroredRepositories( Collections.singletonList( repository ) ); return repo; }
/** * Get remote repository. * @return Remote repository. */ public RemoteRepository remote() { final RemoteRepository remote = new RemoteRepository(); remote.setId(this.identifier); remote.setContentType(this.type); remote.setUrl(this.url); remote.setPolicy(false, this.release); remote.setPolicy(true, this.snapshot); if (this.authentication != null) { remote.setAuthentication(this.authentication.getAuthentication()); } if (this.repoproxy != null) { remote.setProxy(this.repoproxy.getProxy()); } remote.setRepositoryManager(this.manager); final List<RemoteRepository> remotes = new LinkedList<RemoteRepository>(); remote.setMirroredRepositories(remotes); return remote; } }
/** * Get remote repository. * @return Remote repository. */ public RemoteRepository remote() { final RemoteRepository remote = new RemoteRepository(); remote.setId(this.identifier); remote.setContentType(this.type); remote.setUrl(this.url); remote.setPolicy(false, this.release); remote.setPolicy(true, this.snapshot); if (this.authentication != null) { remote.setAuthentication(this.authentication.getAuthentication()); } if (this.repoproxy != null) { remote.setProxy(this.repoproxy.getProxy()); } remote.setRepositoryManager(this.manager); final List<RemoteRepository> remotes = new LinkedList<RemoteRepository>(); remote.setMirroredRepositories(remotes); for (final SimpleRepository repo : this.mirrored) { remotes.add(repo.remote()); } return remote; } }
merged.setProxy( dominant.getProxy() ); merged.setPolicy( false, dominant.getPolicy( false ) ); merged.setPolicy( true, dominant.getPolicy( true ) ); merged.setPolicy( false, merge( session, merged.getPolicy( false ), rec.getPolicy( false ) ) ); merged.setPolicy( true, merge( session, merged.getPolicy( true ), rec.getPolicy( true ) ) );
/** * Creates a shallow copy of the specified repository. * * @param repository The repository to copy, must not be {@code null}. */ public RemoteRepository( RemoteRepository repository ) { setId( repository.getId() ); setContentType( repository.getContentType() ); setUrl( repository.getUrl() ); setPolicy( true, repository.getPolicy( true ) ); setPolicy( false, repository.getPolicy( false ) ); setAuthentication( repository.getAuthentication() ); setProxy( repository.getProxy() ); setMirroredRepositories( repository.getMirroredRepositories() ); setRepositoryManager( repository.isRepositoryManager() ); }
/** * Creates a shallow copy of the specified repository. * * @param repository The repository to copy, must not be {@code null}. */ public RemoteRepository( RemoteRepository repository ) { setId( repository.getId() ); setContentType( repository.getContentType() ); setUrl( repository.getUrl() ); setPolicy( true, repository.getPolicy( true ) ); setPolicy( false, repository.getPolicy( false ) ); setAuthentication( repository.getAuthentication() ); setProxy( repository.getProxy() ); setMirroredRepositories( repository.getMirroredRepositories() ); setRepositoryManager( repository.isRepositoryManager() ); }
/** * Creates a shallow copy of the specified repository. * * @param repository The repository to copy, must not be {@code null}. */ public RemoteRepository( RemoteRepository repository ) { setId( repository.getId() ); setContentType( repository.getContentType() ); setUrl( repository.getUrl() ); setPolicy( true, repository.getPolicy( true ) ); setPolicy( false, repository.getPolicy( false ) ); setAuthentication( repository.getAuthentication() ); setProxy( repository.getProxy() ); setMirroredRepositories( repository.getMirroredRepositories() ); setRepositoryManager( repository.isRepositoryManager() ); }