当前位置: 首页>>代码示例>>Java>>正文


Java DefaultRepositorySystemSession.setLocalRepositoryManager方法代码示例

本文整理汇总了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;
   }
 
开发者ID:microsofia,项目名称:microsofia-boot,代码行数:28,代码来源:RepositorySystemSessionBuilder.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer,代码行数:23,代码来源:MavenArtifactResolver.java

示例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());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:20,代码来源:MavenSettingsReader.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:17,代码来源:DependencyResolver.java

示例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;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:24,代码来源:AetherClasspathResolver.java

示例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;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:19,代码来源:InstallDeployTest.java

示例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);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:Publisher.java

示例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;
}
 
开发者ID:Gemba,项目名称:mvn-dd,代码行数:26,代码来源:RepositorySystemHelper.java

示例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;
}
 
开发者ID:SetoKaiba,项目名称:aether-gradle-plugin,代码行数:10,代码来源:VersionResolverDependencyResolveDetails.java

示例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;
    }
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:8,代码来源:MavenDependencyResolver.java

示例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;
}
 
开发者ID:bazelbuild,项目名称:migration-tooling,代码行数:21,代码来源:Aether.java

示例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;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:28,代码来源:Utils.java

示例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;
}
 
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:14,代码来源:AbstractMavenBasedDeployer.java

示例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;
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:12,代码来源:Booter.java


注:本文中的org.eclipse.aether.DefaultRepositorySystemSession.setLocalRepositoryManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。