org.gradle.mvn3.org.sonatype.aether.RepositorySystemSession

Here are the examples of the java api org.gradle.mvn3.org.sonatype.aether.RepositorySystemSession taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

7 Source : MavenProjectsCreator.java
with BSD 2-Clause "Simplified" License
from PushFish

private Set<MavenProject> createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
    // using jarjar for maven3 clreplacedes affects the contents of the effective pom
    // references to certain Maven standard plugins contain jarjar in the fqn
    // not sure if this is a problem.
    ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration().setClreplacedWorld(new ClreplacedWorld("plexus.core", ClreplacedWorld.clreplaced.getClreplacedLoader())).setName("mavenCore");
    DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
    ProjectBuilder builder = container.lookup(ProjectBuilder.clreplaced);
    MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
    final Properties properties = new Properties();
    properties.putAll(SystemProperties.asMap());
    executionRequest.setSystemProperties(properties);
    MavenExecutionRequestPopulator populator = container.lookup(MavenExecutionRequestPopulator.clreplaced);
    populator.populateFromSettings(executionRequest, settings);
    populator.populateDefaults(executionRequest);
    ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest();
    buildingRequest.setProcessPlugins(false);
    MavenProject mavenProject = builder.build(pomFile, buildingRequest).getProject();
    Set<MavenProject> reactorProjects = new LinkedHashSet<MavenProject>();
    // TODO adding the parent project first because the converter needs it this way ATM. This is oversimplified.
    // the converter should not depend on the order of reactor projects.
    // we should add coverage for nested multi-project builds with multiple parents.
    reactorProjects.add(mavenProject);
    List<ProjectBuildingResult> allProjects = builder.build(ImmutableList.of(pomFile), true, buildingRequest);
    CollectionUtils.collect(allProjects, reactorProjects, new Transformer<MavenProject, ProjectBuildingResult>() {

        public MavenProject transform(ProjectBuildingResult original) {
            return original.getProject();
        }
    });
    MavenExecutionResult result = new DefaultMavenExecutionResult();
    result.setProject(mavenProject);
    RepositorySystemSession repoSession = new DefaultRepositorySystemSession();
    MavenSession session = new MavenSession(container, repoSession, executionRequest, result);
    session.setCurrentProject(mavenProject);
    return reactorProjects;
}