本文整理汇总了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)
);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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();
}
示例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();
}
}
示例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;
}
示例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());
}
示例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;
}