@Override public RepositoryURL getURL( ) { try { return new RepositoryURL( repository.getLocation( ).toString( ) ); } catch ( Exception e ) { log.error( "Could not convert location url {}", repository.getLocation( ) ); return new RepositoryURL( "" ); } }
/** * Convert a path to an artifact reference. * * @param path the path to convert. (relative or full url path) * @throws LayoutException if the path cannot be converted to an artifact reference. */ @Override public ArtifactReference toArtifactReference( String path ) throws LayoutException { if ( ( path != null ) && repository.getLocation()!=null && path.startsWith( repository.getLocation().toString() ) ) { return super.toArtifactReference( path.substring( repository.getLocation().toString().length( ) ) ); } return super.toArtifactReference( path ); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "ProxyConnector[\n" ); sb.append( " source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" ); sb.append( " target: [remote] " ).append( this.targetRepository.getRepository().getLocation() ).append( "\n" ); sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" ); Iterator<String> keys = this.policies.keySet().iterator(); while ( keys.hasNext() ) { String name = keys.next(); sb.append( " policy[" ).append( name ).append( "]:" ); sb.append( this.policies.get( name ) ).append( "\n" ); } sb.append( "]" ); return sb.toString(); }
@Override public RepositoryURL toURL( ArtifactReference reference ) { String url = repository.getLocation( ) + toPath( reference ); return new RepositoryURL( url ); } }
String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif ); try
try String protocol = getProtocol( remoteRepository.getLocation().toString() ); final NetworkProxy networkProxy = this.networkProxyMap.get( remoteRepository.getId() );
+ " to connect to remote repository " + remoteRepository.getLocation(); if ( networkProxy.getNonProxyHosts() != null ) log.debug( "Using username {} to connect to remote repository {}", username, remoteRepository.getLocation() ); authInfo = new AuthenticationInfo(); authInfo.setUserName( username ); new org.apache.maven.wagon.repository.Repository( remoteRepository.getId(), remoteRepository.getLocation().toString() ); if ( networkProxy != null )
private void resolve( ResolveRequest resolveRequest ) { RepositorySystem system = mavenSystemManager.getRepositorySystem(); RepositorySystemSession session = MavenSystemManager.newRepositorySystemSession( resolveRequest.localRepoDir ); org.eclipse.aether.artifact.Artifact artifact = new DefaultArtifact( resolveRequest.groupId + ":" + resolveRequest.artifactId + ":" + resolveRequest.version ); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot( new Dependency( artifact, "" ) ); // add remote repositories for ( RemoteRepository remoteRepository : resolveRequest.remoteRepositories ) { org.eclipse.aether.repository.RemoteRepository repo = new org.eclipse.aether.repository.RemoteRepository.Builder( remoteRepository.getId( ), "default", remoteRepository.getLocation( ).toString() ).build( ); collectRequest.addRepository(repo); } collectRequest.setRequestContext( "project" ); //collectRequest.addRepository( repo ); try { CollectResult collectResult = system.collectDependencies( session, collectRequest ); collectResult.getRoot().accept( resolveRequest.dependencyVisitor ); log.debug("Collected dependency results for resolve"); } catch ( DependencyCollectionException e ) { log.error( "Error while collecting dependencies (resolve): {}", e.getMessage(), e ); } }
String baseIndexUrl = indexingContext.getIndexUpdateUrl(); String wagonProtocol = this.remoteRepository.getLocation().getScheme();
cfg.setName(remoteRepository.getName()); cfg.setDescription(remoteRepository.getDescription()); cfg.setUrl(remoteRepository.getLocation().toString()); cfg.setTimeout((int) remoteRepository.getTimeout().toMillis() / 1000); cfg.setCheckPath(remoteRepository.getCheckPath());
@Override public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) { RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( ); configuration.setId( remoteRepository.getId( ) ); configuration.setName( remoteRepository.getName( ) ); configuration.setDescription( remoteRepository.getDescription( ) ); configuration.setLayout( remoteRepository.getLayout( ) ); configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) ); configuration.setCheckPath( remoteRepository.getCheckPath( ) ); configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) ); configuration.setExtraParameters( remoteRepository.getExtraParameters( ) ); configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) ); RepositoryCredentials creds = remoteRepository.getLoginCredentials( ); if (creds!=null) { PasswordCredentials pwdCreds = (PasswordCredentials) creds; configuration.setUsername( pwdCreds.getUsername( ) ); configuration.setPassword( new String( pwdCreds.getPassword( ) ) ); } configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) ); RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) ); configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) ); configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) ); configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) ); return configuration; }