本文整理汇总了Java中org.eclipse.aether.DefaultRepositorySystemSession类的典型用法代码示例。如果您正苦于以下问题:Java DefaultRepositorySystemSession类的具体用法?Java DefaultRepositorySystemSession怎么用?Java DefaultRepositorySystemSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultRepositorySystemSession类属于org.eclipse.aether包,在下文中一共展示了DefaultRepositorySystemSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectDependencies
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
@Override
public CollectResult collectDependencies(RepositorySystemSession session, CollectRequest request) throws DependencyCollectionException {
DefaultRepositorySystemSession cloned = new DefaultRepositorySystemSession(session);
DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();
//need to reset the transformer to prevent the transformation to happen and to it below separately.
cloned.setDependencyGraphTransformer(null);
CollectResult res = super.collectDependencies(cloned, request);
CloningDependencyVisitor vis = new CloningDependencyVisitor();
res.getRoot().accept(vis);
//this part copied from DefaultDependencyCollector
try {
DefaultDependencyGraphTransformationContext context =
new DefaultDependencyGraphTransformationContext(session);
res.setRoot(transformer.transformGraph(res.getRoot(), context));
} catch (RepositoryException e) {
res.addException(e);
}
if (!res.getExceptions().isEmpty()) {
throw new DependencyCollectionException(res);
}
res.getRoot().setData("NB_TEST", vis.getRootNode());
return res;
}
示例2: create
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
public static AetherGrapeEngine create(GroovyClassLoader classLoader,
List<RepositoryConfiguration> repositoryConfigurations,
DependencyResolutionContext dependencyResolutionContext) {
RepositorySystem repositorySystem = createServiceLocator()
.getService(RepositorySystem.class);
DefaultRepositorySystemSession repositorySystemSession = MavenRepositorySystemUtils
.newSession();
ServiceLoader<RepositorySystemSessionAutoConfiguration> autoConfigurations = ServiceLoader
.load(RepositorySystemSessionAutoConfiguration.class);
for (RepositorySystemSessionAutoConfiguration autoConfiguration : autoConfigurations) {
autoConfiguration.apply(repositorySystemSession, repositorySystem);
}
new DefaultRepositorySystemSessionAutoConfiguration()
.apply(repositorySystemSession, repositorySystem);
return new AetherGrapeEngine(classLoader, repositorySystem,
repositorySystemSession, createRepositories(repositoryConfigurations),
dependencyResolutionContext);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:25,代码来源:AetherGrapeEngineFactory.java
示例3: AetherGrapeEngine
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
public AetherGrapeEngine(GroovyClassLoader classLoader,
RepositorySystem repositorySystem,
DefaultRepositorySystemSession repositorySystemSession,
List<RemoteRepository> remoteRepositories,
DependencyResolutionContext resolutionContext) {
this.classLoader = classLoader;
this.repositorySystem = repositorySystem;
this.session = repositorySystemSession;
this.resolutionContext = resolutionContext;
this.repositories = new ArrayList<RemoteRepository>();
List<RemoteRepository> remotes = new ArrayList<RemoteRepository>(
remoteRepositories);
Collections.reverse(remotes); // priority is reversed in addRepository
for (RemoteRepository repository : remotes) {
addRepository(repository);
}
this.progressReporter = getProgressReporter(this.session);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:AetherGrapeEngine.java
示例4: apply
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
@Override
public void apply(DefaultRepositorySystemSession session,
RepositorySystem repositorySystem) {
if (session.getLocalRepositoryManager() == null) {
LocalRepository localRepository = new LocalRepository(getM2RepoDirectory());
LocalRepositoryManager localRepositoryManager = repositorySystem
.newLocalRepositoryManager(session, localRepository);
session.setLocalRepositoryManager(localRepositoryManager);
}
ProxySelector existing = session.getProxySelector();
if (existing == null || !(existing instanceof CompositeProxySelector)) {
JreProxySelector fallback = new JreProxySelector();
ProxySelector selector = existing == null ? fallback
: new CompositeProxySelector(Arrays.asList(existing, fallback));
session.setProxySelector(selector);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:DefaultRepositorySystemSessionAutoConfiguration.java
示例5: assertSessionCustomization
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private void assertSessionCustomization(String userHome) {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
SystemProperties.doWithSystemProperties(new Runnable() {
@Override
public void run() {
new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session,
SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem);
}
}, "user.home:" + userHome);
RemoteRepository repository = new RemoteRepository.Builder("my-server", "default",
"http://maven.example.com").build();
assertMirrorSelectorConfiguration(session, repository);
assertProxySelectorConfiguration(session, repository);
assertAuthenticationSelectorConfiguration(session, repository);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java
示例6: proxySelector
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
@Test
public void proxySelector() {
doWithCustomUserHome(new Runnable() {
@Override
public void run() {
AetherGrapeEngine grapeEngine = createGrapeEngine();
DefaultRepositorySystemSession session = (DefaultRepositorySystemSession) ReflectionTestUtils
.getField(grapeEngine, "session");
assertThat(session.getProxySelector() instanceof CompositeProxySelector)
.isTrue();
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:AetherGrapeEngineTests.java
示例7: create
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
/**
* Uses the passed Settings in order to configure and create the session
* */
public RepositorySystemSession create(){
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setOffline(settings.getOffline()!=null ? settings.getOffline().booleanValue() : false);
session.setIgnoreArtifactDescriptorRepositories(true);
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_WARN);
session.setUpdatePolicy(settings.getUpdatePolicy());
LocalRepository localRepo = new LocalRepository(settings.getLocalRepository());
session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( session, localRepo ) );
session.setRepositoryListener( new microsofia.boot.aether.RepositoryListener() );
session.setTransferListener( new microsofia.boot.aether.TransferListener() );
/*TODO should allow the followig to be configured via settings file? (if needed)
* session.setResolutionErrorPolicy();
session.setArtifactDescriptorPolicy(artifactDescriptorPolicy)
session.setSystemProperties(systemProperties)
session.setUserProperties(userProperties)
session.setConfigProperties(configProperties)*/
return session;
}
示例8: newRepositorySystemSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, String localRepoPath) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localRepoPath);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
session.setOffline(this.properties.isOffline());
if (this.properties.getConnectTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.CONNECT_TIMEOUT, this.properties.getConnectTimeout());
}
if (this.properties.getRequestTimeout() != null) {
session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, this.properties.getRequestTimeout());
}
if (isProxyEnabled()) {
DefaultProxySelector proxySelector = new DefaultProxySelector();
Proxy proxy = new Proxy(this.properties.getProxy().getProtocol(),
this.properties.getProxy().getHost(),
this.properties.getProxy().getPort(),
this.authentication);
proxySelector.add(proxy, this.properties.getProxy().getNonProxyHosts());
session.setProxySelector(proxySelector);
}
return session;
}
示例9: applySettings
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
public static void applySettings(MavenSettings settings,
DefaultRepositorySystemSession session) {
if (settings.getLocalRepository() != null) {
try {
session.setLocalRepositoryManager(
new SimpleLocalRepositoryManagerFactory().newInstance(session,
new LocalRepository(settings.getLocalRepository())));
}
catch (NoLocalRepositoryManagerException e) {
throw new IllegalStateException(
"Cannot set local repository to " + settings.getLocalRepository(),
e);
}
}
session.setOffline(settings.getOffline());
session.setMirrorSelector(settings.getMirrorSelector());
session.setAuthenticationSelector(settings.getAuthenticationSelector());
session.setProxySelector(settings.getProxySelector());
}
示例10: createSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private DefaultRepositorySystemSession createSession(Properties properties)
throws NoLocalRepositoryManagerException {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository repository = localRepository(properties);
session.setLocalRepositoryManager(
localRepositoryManagerFactory.newInstance(session, repository));
applySettings(session);
ProxySelector existing = session.getProxySelector();
if (existing == null || !(existing instanceof CompositeProxySelector)) {
JreProxySelector fallback = new JreProxySelector();
ProxySelector selector = existing == null ? fallback
: new CompositeProxySelector(Arrays.asList(existing, fallback));
session.setProxySelector(selector);
}
return session;
}
示例11: assertSessionCustomization
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private void assertSessionCustomization(String userHome) {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
SystemProperties.doWithSystemProperties(new Runnable() {
@Override
public void run() {
new SettingsXmlRepositorySystemSessionAutoConfiguration().apply(session,
SettingsXmlRepositorySystemSessionAutoConfigurationTests.this.repositorySystem);
}
}, "user.home:" + userHome);
RemoteRepository repository = new RemoteRepository.Builder("my-server", "default",
"http://maven.example.com").build();
assertMirrorSelectorConfiguration(session, repository);
assertProxySelectorConfiguration(session, repository);
assertAuthenticationSelectorConfiguration(session, repository);
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:20,代码来源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java
示例12: newRepositorySystemSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private DefaultRepositorySystemSession newRepositorySystemSession(
RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils
.newSession();
// every container must have one
session.setLocalRepositoryManager(system.newLocalRepositoryManager(
session, findLocalRepository()));
// logging for the activity
PrintStream logger = new LoggerStream(LOG, Level.INFO);
session.setTransferListener(new LoggingTransferListener());
session.setRepositoryListener(new LoggingRepositoryListener());
// uncomment to generate dirty trees
// session.setDependencyGraphTransformer( null );
// ignore checksums on smartbear
session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
return session;
}
示例13: resolveDependencies
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
protected void resolveDependencies() throws MojoExecutionException {
DependencyResolutionResult depRes;
try {
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(mavenSession.getRepositorySession());
((DefaultRepositorySystemSession)repositorySession).setDependencySelector(newRootScopeDependencySelector(repositorySession.getDependencySelector(), 0));
DefaultDependencyResolutionRequest depReq = new DefaultDependencyResolutionRequest(project, repositorySession);
depRes = depsResolver.resolve(depReq);
} catch (DependencyResolutionException e) {
throw new MojoExecutionException("Cannot resolve dependencies for "+project, e);
}
rootDependencyGraph = depRes.getDependencyGraph();
getLog().debug("Dependency graph with scopes "+includeDependencyScopes+":");
dump("", rootDependencyGraph);
projectByIdCache.put(Coords.of(project).normal(), project);
collectDeps(rootDependencyGraph, project, 0);
}
示例14: resolve
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
/**
* Resolves all dependencies for the external metrics
*/
public void resolve(){
RepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository("/tmp/luzzu/local-repo");
((DefaultRepositorySystemSession) session).setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
try {
List<POMDependency> dep = getPOMDependencies(pomFileName);
for(POMDependency d : dep) installDependency(d.groupId, d.artifactId, d.version, session);
} catch (ParserConfigurationException | SAXException | IOException | DependencyResolutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例15: newSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入依赖的package包/类
private MavenSession newSession(MavenProject project, File localrepo, Properties properties) throws Exception {
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repoSession = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localrepo);
repoSession.setLocalRepositoryManager(mojos.getContainer().lookup(LocalRepositoryManagerFactory.class, "simple").newInstance(repoSession, localRepo));
MavenSession session = new MavenSession(mojos.getContainer(), repoSession, request, result);
List<MavenProject> projects = new ArrayList<>();
projects.add(project);
for (String module : project.getModules()) {
MavenProject moduleProject = readMavenProject(new File(project.getBasedir(), module), properties);
moduleProject.setParent(project);
projects.add(moduleProject);
}
session.setProjects(projects);
return session;
}