本文整理匯總了Java中org.eclipse.aether.collection.CollectRequest.addRepository方法的典型用法代碼示例。如果您正苦於以下問題:Java CollectRequest.addRepository方法的具體用法?Java CollectRequest.addRepository怎麽用?Java CollectRequest.addRepository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.aether.collection.CollectRequest
的用法示例。
在下文中一共展示了CollectRequest.addRepository方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: RepositorySystemHelper
import org.eclipse.aether.collection.CollectRequest; //導入方法依賴的package包/類
/**
* Initalizes the aether environment. Uses these repositories:
* <ul>
* <li>http://central.maven.org/maven2/
* </ul>
*
* @param localRepoDir
* path where to put the downloaded dependencies
* @param extraRepos
* map with extra repositories <id, url>.
*/
public RepositorySystemHelper(String localRepoDir, Map<String, String> extraRepos) {
repoSystem = newRepositorySystem();
session = newSession(repoSystem, localRepoDir);
RemoteRepository central = new RemoteRepository.Builder("central", "default", "http://central.maven.org/maven2/").build();
collectRequest = new CollectRequest();
collectRequest.addRepository(central);
RemoteRepository repo = null;
Iterator<Entry<String, String>> iterator = extraRepos.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> e = iterator.next();
repo = new RemoteRepository.Builder(e.getKey(), "default", e.getValue()).build();
collectRequest.addRepository(repo);
log.debug("Using extra repository '{}': {}", e.getKey(), e.getValue());
}
}
示例2: createCollectRequestForGAV
import org.eclipse.aether.collection.CollectRequest; //導入方法依賴的package包/類
protected CollectRequest createCollectRequestForGAV(String gav) {
DefaultArtifact artifact = new DefaultArtifact(gav);
Dependency dependency = new Dependency(artifact, getScope());
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(dependency);
for (RemoteRepository repository : repositories) {
collectRequest.addRepository(repository);
}
return collectRequest;
}
示例3: installDependency
import org.eclipse.aether.collection.CollectRequest; //導入方法依賴的package包/類
private void installDependency(String groupId, String artifactId, String version, RepositorySystemSession session) throws DependencyResolutionException{
logger.info("Installing and Loading Dependency : {} - {} - {} ", groupId , artifactId, version);
Dependency dependency = new Dependency( new DefaultArtifact(groupId, artifactId, "", "jar", version ), "compile" );
RemoteRepository central = new RemoteRepository.Builder( "central", "default", "http://central.maven.org/maven2/" ).build();
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot( dependency );
collectRequest.addRepository( central );
DependencyRequest dependencyRequest = new DependencyRequest();
dependencyRequest.setCollectRequest( collectRequest );
system.resolveDependencies(session, dependencyRequest ).getRoot();
}