use of org.eclipse.aether.repository.LocalRepository in project kie-wb-common by kiegroup.
the class MavenDependencyConfigExecutorTest method installArtifactLocally.
private void installArtifactLocally(final String groupId, final String artifactId, final String version) throws Exception {
Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "pom", version);
final Path pom = getPom(groupId, artifactId, version);
pomArtifact = pomArtifact.setFile(pom.toFile());
final InstallRequest installRequest = new InstallRequest();
installRequest.addArtifact(pomArtifact);
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
RepositorySystem system = locator.getService(RepositorySystem.class);
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
final LocalRepository localRepo = new LocalRepository(m2Folder);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
system.install(session, installRequest);
}
use of org.eclipse.aether.repository.LocalRepository in project spring-boot by spring-projects.
the class GrapeRootRepositorySystemSessionAutoConfiguration method configureLocalRepository.
private void configureLocalRepository(DefaultRepositorySystemSession session, RepositorySystem repositorySystem, String grapeRoot) {
File repositoryDir = new File(grapeRoot, "repository");
LocalRepository localRepository = new LocalRepository(repositoryDir);
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(session, localRepository);
session.setLocalRepositoryManager(localRepositoryManager);
}
use of org.eclipse.aether.repository.LocalRepository in project spring-boot by spring-projects.
the class DefaultRepositorySystemSessionAutoConfiguration method apply.
@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 instanceof CompositeProxySelector)) {
JreProxySelector fallback = new JreProxySelector();
ProxySelector selector = (existing != null) ? new CompositeProxySelector(Arrays.asList(existing, fallback)) : fallback;
session.setProxySelector(selector);
}
}
use of org.eclipse.aether.repository.LocalRepository in project meecrowave by apache.
the class MeecrowaveRunMojoTest method setupMojoExecution.
@Before
public void setupMojoExecution() throws Exception {
final File moduleBase = jarLocation(MeecrowaveRunMojoTest.class).getParentFile().getParentFile();
final File basedir = new File(moduleBase, "src/test/resources/" + getClass().getSimpleName());
final File pom = new File(basedir, "pom.xml");
final MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setBaseDirectory(basedir);
final ProjectBuildingRequest configuration = request.getProjectBuildingRequest();
final DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory().newInstance(repositorySession, new LocalRepository(new File(moduleBase, "target/fake"), "")));
configuration.setRepositorySession(repositorySession);
project = mojo.lookup(ProjectBuilder.class).build(pom, configuration).getProject();
session = mojo.newMavenSession(project);
try (final ServerSocket serverSocket = new ServerSocket(0)) {
port = serverSocket.getLocalPort();
}
execution = mojo.newMojoExecution("run");
}
use of org.eclipse.aether.repository.LocalRepository in project BIMserver by opensourceBIM.
the class MavenPluginRepository method newRepositorySystemSession.
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, File localRepoFile, Settings settings) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
if (!settings.getMirrors().isEmpty()) {
DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
for (Mirror mirror : settings.getMirrors()) {
mirrorSelector.add(mirror.getId(), mirror.getUrl(), "default", true, mirror.getMirrorOf(), "*");
}
session.setMirrorSelector(mirrorSelector);
}
session.setProxySelector(proxySelector);
LocalRepository localRepo = new LocalRepository(localRepoFile);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
return session;
}
Aggregations