本文整理汇总了Java中org.eclipse.aether.DefaultRepositorySystemSession.setLocalRepositoryManager方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultRepositorySystemSession.setLocalRepositoryManager方法的具体用法?Java DefaultRepositorySystemSession.setLocalRepositoryManager怎么用?Java DefaultRepositorySystemSession.setLocalRepositoryManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.aether.DefaultRepositorySystemSession
的用法示例。
在下文中一共展示了DefaultRepositorySystemSession.setLocalRepositoryManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
示例2: 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;
}
示例3: 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;
}
示例4: 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());
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: publish
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
/**
* @param toPublish each {@link Artifact} must contain a file, that will be published under maven
* coordinates in the corresponding {@link Artifact}.
* @see Artifact#setFile
*/
public DeployResult publish(List<Artifact> toPublish) throws DeploymentException {
RepositorySystem repoSys =
Preconditions.checkNotNull(locator.getService(RepositorySystem.class));
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setLocalRepositoryManager(repoSys.newLocalRepositoryManager(session, localRepo));
session.setReadOnly();
DeployRequest deployRequest = createDeployRequest(toPublish);
if (dryRun) {
return new DeployResult(deployRequest)
.setArtifacts(toPublish)
.setMetadata(deployRequest.getMetadata());
} else {
return repoSys.deploy(session, deployRequest);
}
}
示例9: newSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
/**
* Set up repository session for maven.
*
* @param system
* the repository system
* @param localDownloadDir
* the directory where to put the downloaded artifacts
* @return the configured repository session
*/
private RepositorySystemSession newSession(RepositorySystem system, final String localDownloadDir) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localDownloadDir);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
DependencySelector depFilter =
new AndDependencySelector(
new ScopeDependencySelector(JavaScopes.PROVIDED),
new OptionalDependencySelector(),
new ExclusionDependencySelector()
);
session.setDependencySelector(depFilter);
return session;
}
示例10: setupSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public RepositorySystemSession setupSession(Project project, RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
File dir = new File(project.getProjectDir(), "aether/repository");
LocalRepository localRepo = new LocalRepository(dir);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
return session;
}
示例11: createRepositorySystemSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
private static DefaultRepositorySystemSession createRepositorySystemSession(final RepositorySystem system, final File repository_home) {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
final LocalRepository local_repository = new LocalRepository(repository_home);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, local_repository));
return session;
}
示例12: newRepositorySession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
/**
* Aether and its components are designed to be stateless. All configurations and state
* are provided through the RepositorySystemSession.
*
* TODO(petros): Separate this out into its own class.
* This is the most intricate element of Aether.
* There are various settings that are useful to us.
* Specifically, these are the (1) LocalRepositoryManager, (2) DependencyManager,
* (3) DependencyGraphTransformer, (4) TransferListener, (5) ProxySelector
*/
static RepositorySystemSession newRepositorySession(RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
// TODO(petros): Decide on where to cache things.
LocalRepository localRepository = new LocalRepository("target/local-repo");
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepository));
session.setDependencyManager(new ClassicDependencyManager());
return session;
}
示例13: getRepositorySession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public static DefaultRepositorySystemSession getRepositorySession(RepositorySystem repoSystem, WorkspaceReader workspace) {
DefaultRepositorySystemSession repoSystemSession = MavenRepositorySystemUtils.newSession();
String repoLocation = System.getProperty("user.home") + File.separator
+ ".m2" + File.separator + "repository/";
try {
Settings effectiveSettings = loadMavenSettings();
if(effectiveSettings.getLocalRepository() != null) {
repoLocation = effectiveSettings.getLocalRepository();
}
} catch(Exception e) {
log.warn(
"Unable to load Maven settings, using default repository location",
e);
}
LocalRepository localRepo = new LocalRepository(repoLocation);
log.debug("Using local repository at: " + repoLocation);
repoSystemSession.setLocalRepositoryManager(repoSystem
.newLocalRepositoryManager(repoSystemSession, localRepo));
//repoSystemSession.setWorkspaceReader(new SimpleMavenCache(new File("repo")));
if (workspace != null) repoSystemSession.setWorkspaceReader(workspace);
return repoSystemSession;
}
示例14: createRepositorySession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
private DefaultRepositorySystemSession createRepositorySession() {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setProxySelector(new ConservativeProxySelector(new JreProxySelector()));
LocalRepository localRepo = new LocalRepository(localRepository);
try {
session.setLocalRepositoryManager(
new EnhancedLocalRepositoryManagerFactory().newInstance(session, localRepo));
}
catch (NoLocalRepositoryManagerException e1) {
}
return session;
}
示例15: newRepositorySystemSession
import org.eclipse.aether.DefaultRepositorySystemSession; //导入方法依赖的package包/类
public static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository("target/local-repo");
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
session.setTransferListener(new ConsoleTransferListener());
session.setRepositoryListener(new ConsoleRepositoryListener());
return session;
}