org.gradle.api.publish.maven.internal.publication.MavenPomInternal Java Examples

The following examples show how to use org.gradle.api.publish.maven.internal.publication.MavenPomInternal. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenerateMavenPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
public void doGenerate() {
    MavenPomInternal pomInternal = (MavenPomInternal) getPom();

    MavenPomFileGenerator pomGenerator = new MavenPomFileGenerator(pomInternal.getProjectIdentity());
    pomGenerator.setPackaging(pomInternal.getPackaging());

    for (MavenDependencyInternal runtimeDependency : pomInternal.getRuntimeDependencies()) {
        pomGenerator.addRuntimeDependency(runtimeDependency);
    }

    pomGenerator.withXml(pomInternal.getXmlAction());

    pomGenerator.writeTo(getDestination());
}
 
Example #2
Source File: GenerateMavenPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
public void doGenerate() {
    MavenPomInternal pomInternal = (MavenPomInternal) getPom();

    MavenPomFileGenerator pomGenerator = new MavenPomFileGenerator(pomInternal.getProjectIdentity());
    pomGenerator.setPackaging(pomInternal.getPackaging());

    for (MavenDependencyInternal runtimeDependency : pomInternal.getRuntimeDependencies()) {
        pomGenerator.addRuntimeDependency(runtimeDependency);
    }

    pomGenerator.withXml(pomInternal.getXmlAction());

    pomGenerator.writeTo(getDestination());
}
 
Example #3
Source File: GenerateMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
public void doGenerate() {
    MavenPomInternal pomInternal = (MavenPomInternal) getPom();

    MavenPomFileGenerator pomGenerator = new MavenPomFileGenerator(pomInternal.getProjectIdentity());
    pomGenerator.setPackaging(pomInternal.getPackaging());

    for (MavenDependencyInternal runtimeDependency : pomInternal.getRuntimeDependencies()) {
        pomGenerator.addRuntimeDependency(runtimeDependency);
    }

    pomGenerator.withXml(pomInternal.getXmlAction());

    pomGenerator.writeTo(getDestination());
}
 
Example #4
Source File: GenerateMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
public void doGenerate() {
    MavenPomInternal pomInternal = (MavenPomInternal) getPom();

    MavenPomFileGenerator pomGenerator = new MavenPomFileGenerator(pomInternal.getProjectIdentity());
    pomGenerator.setPackaging(pomInternal.getPackaging());

    for (MavenDependencyInternal runtimeDependency : pomInternal.getRuntimeDependencies()) {
        pomGenerator.addRuntimeDependency(runtimeDependency);
    }

    pomGenerator.withXml(pomInternal.getXmlAction());

    pomGenerator.writeTo(getDestination());
}
 
Example #5
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 4 votes vote down vote up
private void configureMavenPublication(MavenPublication mavenPublication) {
    mavenPublication.pom(pom -> {
        pom.getUrl().convention(getRepo().map(repo -> hasText(repo.getHomepage()).orElse(repo.getHtml_url())));
        pom.getDescription().convention(getRepo().flatMap(repo -> project.provider(() -> hasText(repo.getDescription()).orElse(project.getDescription()))));
        pom.getName().convention(project.getName());
        pom.getInceptionYear().convention(getRepo().map(repo -> repo.getCreated_at().substring(0, 4)));

        pom.organization(organization -> {
            organization.getName().convention(getUser().map(user -> hasText(user.getName()).orElse(user.getLogin())));
            organization.getUrl().convention(getUser().map(user -> hasText(user.getBlog()).orElse(user.getHtml_url())));
        });

        project.afterEvaluate(rp -> {
            if (githubExtension.getTravis().getOrElse(false)) {
                pom.ciManagement(ciManagement -> {
                    ciManagement.getSystem().convention("Travis CI");
                    ciManagement.getUrl().convention(githubExtension.getSlug().map(slug -> String.format("https://travis-ci.org/%s/", slug)));
                });
            }

            if (getRepo().map(Repo::isHas_issues).getOrElse(true)) {
                pom.issueManagement(issueManagement -> {
                    issueManagement.getSystem().convention("GitHub Issues");
                    issueManagement.getUrl().convention(githubExtension.getSlug().map(slug -> String.format("https://github.com/%s/issues", slug)));
                });
            }

            if (getLicense().isPresent() && ((MavenPomInternal) pom).getLicenses().isEmpty()) {
                pom.licenses(licences -> {
                    licences.license(licence -> {
                        licence.getName().convention(getLicense().map(License::getName));
                        licence.getUrl().convention(getLicense().map(License::getHtml_url));
                        licence.getComments().convention(getLicense().map(License::getDescription));
                    });
                });
            }
        });

        pom.scm(scm -> {
            scm.getUrl().convention(getRepo().map(Repo::getHtml_url));
            scm.getConnection().convention(getRepo().map(repo -> "scm:git:" + repo.getClone_url()));
            scm.getDeveloperConnection().convention(scm.getConnection());
            scm.getTag().convention(githubExtension.getTag());
        });


    });
}
 
Example #6
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 4 votes vote down vote up
private void configureMavenPublication(MavenPublication mavenPublication) {
    mavenPublication.pom(pom -> {
        pom.getUrl().convention(getRepo().map(repo -> hasText(repo.getHomepage()).orElse(repo.getHtml_url())));
        pom.getDescription().convention(getRepo().flatMap(repo -> project.provider(() -> hasText(repo.getDescription()).orElse(project.getDescription()))));
        pom.getName().convention(project.getName());
        pom.getInceptionYear().convention(getRepo().map(repo -> repo.getCreated_at().substring(0, 4)));

        pom.organization(organization -> {
            organization.getName().convention(getUser().map(user -> hasText(user.getName()).orElse(user.getLogin())));
            organization.getUrl().convention(getUser().map(user -> hasText(user.getBlog()).orElse(user.getHtml_url())));
        });

        project.afterEvaluate(rp -> {
            if (githubExtension.getTravis().getOrElse(false)) {
                pom.ciManagement(ciManagement -> {
                    ciManagement.getSystem().convention("Travis CI");
                    ciManagement.getUrl().convention(githubExtension.getSlug().map(slug -> String.format("https://travis-ci.org/%s/", slug)));
                });
            }

            if (getRepo().map(Repo::isHas_issues).getOrElse(true)) {
                pom.issueManagement(issueManagement -> {
                    issueManagement.getSystem().convention("GitHub Issues");
                    issueManagement.getUrl().convention(githubExtension.getSlug().map(slug -> String.format("https://github.com/%s/issues", slug)));
                });
            }

            if (getLicense().isPresent() && ((MavenPomInternal) pom).getLicenses().isEmpty()) {
                pom.licenses(licences -> {
                    licences.license(licence -> {
                        licence.getName().convention(getLicense().map(License::getName));
                        licence.getUrl().convention(getLicense().map(License::getHtml_url));
                        licence.getComments().convention(getLicense().map(License::getDescription));
                    });
                });
            }
        });

        pom.scm(scm -> {
            scm.getUrl().convention(getRepo().map(Repo::getHtml_url));
            scm.getConnection().convention(getRepo().map(repo -> "scm:git:" + repo.getClone_url()));
            scm.getDeveloperConnection().convention(scm.getConnection());
            scm.getTag().convention(githubExtension.getTag());
        });


    });
}