本文整理汇总了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();
}