Package org.gradle.mvn3.org.sonatype.aether

Examples of org.gradle.mvn3.org.sonatype.aether.RepositorySystemSession


        delegate.publish(publication, artifactRepository);
    }

    private void validateIdentity(MavenNormalizedPublication publication) {
        MavenProjectIdentity projectIdentity = publication.getProjectIdentity();
        Model model = parsePomFileIntoMavenModel(publication);
        field(publication, "groupId", projectIdentity.getGroupId())
                .validMavenIdentifier()
                .matches(model.getGroupId());
        field(publication, "artifactId", projectIdentity.getArtifactId())
                .validMavenIdentifier()
                .matches(model.getArtifactId());
        field(publication, "version", projectIdentity.getVersion())
                .notEmpty()
                .validInFileName()
                .matches(model.getVersion());
    }
View Full Code Here


    }

    private Model parsePomFileIntoMavenModel(MavenNormalizedPublication publication) {
        File pomFile = publication.getPomFile();
        try {
            Model model = readModelFromPom(pomFile);
            model.setPomFile(pomFile);
            return model;
        } catch (XmlPullParserException parseException) {
            throw new InvalidMavenPublicationException(publication.getName(),
                    "POM file is invalid. Check any modifications you have made to the POM file.",
                    parseException);
View Full Code Here

    }

    private Model readModelFromPom(File pomFile) throws IOException, XmlPullParserException {
        FileReader reader = new FileReader(pomFile);
        try {
            return new MavenXpp3Reader().read(reader);
        } finally {
            reader.close();
        }
    }
View Full Code Here

    }

    private String toXml(MavenProject project) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            new MavenXpp3Writer().write(out, project.getModel());
        } catch (IOException e) {
            throw new RuntimeException("Unable to serialize Maven model to XML. Maven project: " + project, e);
        }
        return prepareXml(out.toString());
    }
View Full Code Here

    public File getLocalMavenRepository() throws CannotLocateLocalMavenRepositoryException{
        if (systemProperties.containsKey("maven.repo.local")) {
            return new File(systemProperties.get("maven.repo.local"));
        }
        try {
            Settings settings = settingsProvider.buildSettings();
            String repoPath = settings.getLocalRepository();
            if (repoPath != null) {
                return new File(resolvePlaceholders(repoPath.trim()));
            } else {
                File defaultLocation = new File(System.getProperty("user.home"), "/.m2/repository").getAbsoluteFile();
                LOGGER.debug(String.format("No local repository in Settings file defined. Using default path: %s", defaultLocation));
View Full Code Here

    private Set<MavenProject> createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
        //using jarjar for maven3 classes 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()
                .setClassWorld(new ClassWorld("plexus.core", ClassWorld.class.getClassLoader()))
                .setName("mavenCore");

        DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
        ProjectBuilder builder = container.lookup(ProjectBuilder.class);
View Full Code Here

    private Set<MavenProject> createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
        //using jarjar for maven3 classes 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()
                .setClassWorld(new ClassWorld("plexus.core", ClassWorld.class.getClassLoader()))
                .setName("mavenCore");

        DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
        ProjectBuilder builder = container.lookup(ProjectBuilder.class);
View Full Code Here

        //not sure if this is a problem.
        ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration()
                .setClassWorld(new ClassWorld("plexus.core", ClassWorld.class.getClassLoader()))
                .setName("mavenCore");

        DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
        ProjectBuilder builder = container.lookup(ProjectBuilder.class);
        MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
        final Properties properties = new Properties();
        properties.putAll(SystemProperties.asMap());
        executionRequest.setSystemProperties(properties);
        MavenExecutionRequestPopulator populator = container.lookup(MavenExecutionRequestPopulator.class);
        populator.populateFromSettings(executionRequest, settings);
        populator.populateDefaults(executionRequest);
        ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest();
        buildingRequest.setProcessPlugins(false);
        MavenProject mavenProject = builder.build(pomFile, buildingRequest).getProject();
View Full Code Here

    private Set<MavenProject> createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
        //using jarjar for maven3 classes 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()
                .setClassWorld(new ClassWorld("plexus.core", ClassWorld.class.getClassLoader()))
                .setName("mavenCore");

        DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
        ProjectBuilder builder = container.lookup(ProjectBuilder.class);
        MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
View Full Code Here

            }
        });

        MavenExecutionResult result = new DefaultMavenExecutionResult();
        result.setProject(mavenProject);
        RepositorySystemSession repoSession = new DefaultRepositorySystemSession();
        MavenSession session = new MavenSession(container, repoSession, executionRequest, result);
        session.setCurrentProject(mavenProject);

        return reactorProjects;
    }
View Full Code Here

TOP

Related Classes of org.gradle.mvn3.org.sonatype.aether.RepositorySystemSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.