當前位置: 首頁>>代碼示例>>Java>>正文


Java MavenRepositorySystemUtils.newSession方法代碼示例

本文整理匯總了Java中org.apache.maven.repository.internal.MavenRepositorySystemUtils.newSession方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenRepositorySystemUtils.newSession方法的具體用法?Java MavenRepositorySystemUtils.newSession怎麽用?Java MavenRepositorySystemUtils.newSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.repository.internal.MavenRepositorySystemUtils的用法示例。


在下文中一共展示了MavenRepositorySystemUtils.newSession方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DummyAetherRepository

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的package包/類
public DummyAetherRepository(Path baseTempDir) throws IOException {
    tempDir = Files.createTempDirectory(baseTempDir, getClass().getSimpleName());
    try {
        jaxbContext = JAXBContext.newInstance(MutableBundle.class);
    } catch (JAXBException exception) {
        throw new IllegalStateException("Failed to create JAXB context.", exception);
    }

    DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
    repositorySystem = locator.getService(RepositorySystem.class);
    repositorySystemSession = MavenRepositorySystemUtils.newSession();
    localRepository
        = new LocalRepository(Files.createTempDirectory(tempDir, "maven-repo").toFile(), SIMPLE_REPOSITORY_MANAGER);
    repositorySystemSession.setLocalRepositoryManager(
        repositorySystem.newLocalRepositoryManager(repositorySystemSession, localRepository)
    );
}
 
開發者ID:cloudkeeper-project,項目名稱:cloudkeeper,代碼行數:18,代碼來源:DummyAetherRepository.java

示例2: create

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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: assertSessionCustomization

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例4: create

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例5: newRepositorySystemSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例6: createSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例7: assertSessionCustomization

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例8: newRepositorySystemSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例9: resolve

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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();
}
  	
  	
  }
 
開發者ID:EIS-Bonn,項目名稱:Luzzu,代碼行數:20,代碼來源:DependencyLoader.java

示例10: newSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例11: publish

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例12: newSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例13: setupSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例14: createRepositorySystemSession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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

示例15: newRepositorySession

import org.apache.maven.repository.internal.MavenRepositorySystemUtils; //導入方法依賴的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


注:本文中的org.apache.maven.repository.internal.MavenRepositorySystemUtils.newSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。