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


Java LocalRepository類代碼示例

本文整理匯總了Java中org.eclipse.aether.repository.LocalRepository的典型用法代碼示例。如果您正苦於以下問題:Java LocalRepository類的具體用法?Java LocalRepository怎麽用?Java LocalRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: DummyAetherRepository

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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: apply

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例3: noLocalRepositoryWhenNoGrapeRoot

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
@Test
public void noLocalRepositoryWhenNoGrapeRoot() {
	given(this.repositorySystem.newLocalRepositoryManager(eq(this.session),
			any(LocalRepository.class)))
					.willAnswer(new Answer<LocalRepositoryManager>() {

						@Override
						public LocalRepositoryManager answer(
								InvocationOnMock invocation) throws Throwable {
							LocalRepository localRepository = invocation
									.getArgumentAt(1, LocalRepository.class);
							return new SimpleLocalRepositoryManagerFactory()
									.newInstance(
											GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session,
											localRepository);
						}

					});
	new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session,
			this.repositorySystem);
	verify(this.repositorySystem, times(0))
			.newLocalRepositoryManager(eq(this.session), any(LocalRepository.class));
	assertThat(this.session.getLocalRepository()).isNull();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:25,代碼來源:GrapeRootRepositorySystemSessionAutoConfigurationTests.java

示例4: grapeRootConfiguresLocalRepositoryLocation

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
@Test
public void grapeRootConfiguresLocalRepositoryLocation() {
	given(this.repositorySystem.newLocalRepositoryManager(eq(this.session),
			any(LocalRepository.class)))
					.willAnswer(new LocalRepositoryManagerAnswer());

	System.setProperty("grape.root", "foo");
	try {
		new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session,
				this.repositorySystem);
	}
	finally {
		System.clearProperty("grape.root");
	}

	verify(this.repositorySystem, times(1))
			.newLocalRepositoryManager(eq(this.session), any(LocalRepository.class));

	assertThat(this.session.getLocalRepository()).isNotNull();
	assertThat(this.session.getLocalRepository().getBasedir().getAbsolutePath())
			.endsWith(File.separatorChar + "foo" + File.separatorChar + "repository");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:23,代碼來源:GrapeRootRepositorySystemSessionAutoConfigurationTests.java

示例5: create

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例6: newRepositorySystemSession

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例7: applySettings

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例8: createSession

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例9: noLocalRepositoryWhenNoGrapeRoot

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
@Test
public void noLocalRepositoryWhenNoGrapeRoot() {
	given(this.repositorySystem.newLocalRepositoryManager(eq(this.session),
			any(LocalRepository.class)))
					.willAnswer(new Answer<LocalRepositoryManager>() {

						@Override
						public LocalRepositoryManager answer(
								InvocationOnMock invocation) throws Throwable {
							LocalRepository localRepository = invocation
									.getArgumentAt(1, LocalRepository.class);
							return new SimpleLocalRepositoryManagerFactory()
									.newInstance(
											GrapeRootRepositorySystemSessionAutoConfigurationTests.this.session,
											localRepository);
						}
					});

	new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session,
			this.repositorySystem);

	verify(this.repositorySystem, times(0))
			.newLocalRepositoryManager(eq(this.session), any(LocalRepository.class));

	assertThat(this.session.getLocalRepository(), is(nullValue()));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:27,代碼來源:GrapeRootRepositorySystemSessionAutoConfigurationTests.java

示例10: grapeRootConfiguresLocalRepositoryLocation

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
@Test
public void grapeRootConfiguresLocalRepositoryLocation() {
	given(this.repositorySystem.newLocalRepositoryManager(eq(this.session),
			any(LocalRepository.class)))
					.willAnswer(new LocalRepositoryManagerAnswer());

	System.setProperty("grape.root", "foo");
	try {
		new GrapeRootRepositorySystemSessionAutoConfiguration().apply(this.session,
				this.repositorySystem);
	}
	finally {
		System.clearProperty("grape.root");
	}

	verify(this.repositorySystem, times(1))
			.newLocalRepositoryManager(eq(this.session), any(LocalRepository.class));

	assertThat(this.session.getLocalRepository(), is(notNullValue()));
	assertThat(this.session.getLocalRepository().getBasedir().getAbsolutePath(),
			endsWith(File.separatorChar + "foo" + File.separatorChar + "repository"));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:23,代碼來源:GrapeRootRepositorySystemSessionAutoConfigurationTests.java

示例11: init

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
public void init() throws IOException {

		if (deleteLocalRepoOnStartup) {
			deleteLocalRepo();
		} else {
			logger.info("Skipping local repo cleanup");
		}

		logger.info("initial config for Maven Connector");
		this.localM2Repo = new LocalRepository(this.localM2RepoPath);

		Validate.notEmpty(this.pullRepositoryUrls);
		this.pullRemoteRepo = new ArrayList<RemoteRepository>();
		initPullRepoInterval();
		loadAssemblyTemplateFile();
	}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:17,代碼來源:MvnConsumerConfigurer.java

示例12: resolve

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例13: newSession

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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

示例14: Resolver

import org.eclipse.aether.repository.LocalRepository; //導入依賴的package包/類
public Resolver(ArtifactConfig config) {
  this.modelBuilder =
      new DefaultModelBuilderFactory()
          .newInstance()
          .setProfileSelector(new DefaultProfileSelector())
          .setPluginConfigurationExpander(new DefaultPluginConfigurationExpander())
          .setPluginManagementInjector(new DefaultPluginManagementInjector())
          .setDependencyManagementImporter(new DefaultDependencyManagementImporter())
          .setDependencyManagementInjector(new DefaultDependencyManagementInjector());
  ServiceLocator locator = AetherUtil.initServiceLocator();
  this.repoSys = locator.getService(RepositorySystem.class);
  this.localRepo = new LocalRepository(Paths.get(config.mavenLocalRepo).toFile());
  this.session = newSession(repoSys, localRepo);

  this.buckRepoRoot = Paths.get(Preconditions.checkNotNull(config.buckRepoRoot));
  this.buckThirdPartyRelativePath = Paths.get(Preconditions.checkNotNull(config.thirdParty));
  this.visibility = config.visibility;

  this.repos =
      config
          .repositories
          .stream()
          .map(AetherUtil::toRemoteRepository)
          .collect(ImmutableList.toImmutableList());
}
 
開發者ID:facebook,項目名稱:buck,代碼行數:26,代碼來源:Resolver.java

示例15: newSession

import org.eclipse.aether.repository.LocalRepository; //導入依賴的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


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