Java 类org.gradle.api.publish.maven.tasks.GenerateMavenPom 实例源码

项目:Pushjet-Android    文件:MavenPublishPlugin.java   
private void createGeneratePomTask(CollectionBuilder<Task> tasks, final MavenPublicationInternal publication, String publicationName) {
    String descriptorTaskName = String.format("generatePomFileFor%sPublication", capitalize(publicationName));
    tasks.create(descriptorTaskName, GenerateMavenPom.class, new Action<GenerateMavenPom>() {
        public void execute(final GenerateMavenPom generatePomTask) {
            generatePomTask.setDescription(String.format("Generates the Maven POM file for publication '%s'.", publication.getName()));
            generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            generatePomTask.setPom(publication.getPom());

            ConventionMapping descriptorTaskConventionMapping = new DslObject(generatePomTask).getConventionMapping();
            descriptorTaskConventionMapping.map("destination", new Callable<Object>() {
                public Object call() throws Exception {
                    return new File(generatePomTask.getProject().getBuildDir(), "publications/" + publication.getName() + "/pom-default.xml");
                }
            });

            // Wire the generated pom into the publication.
            publication.setPomFile(generatePomTask.getOutputs().getFiles());
        }
    });
}
项目:Pushjet-Android    文件:MavenPublishTaskModelRule.java   
private void createGeneratePomTask(final MavenPublicationInternal publication, String publicationName) {
    String descriptorTaskName = String.format("generatePomFileFor%sPublication", capitalize(publicationName));
    GenerateMavenPom generatePomTask = project.getTasks().create(descriptorTaskName, GenerateMavenPom.class);
    generatePomTask.setDescription(String.format("Generates the Maven POM file for publication '%s'.", publication.getName()));
    generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
    generatePomTask.setPom(publication.getPom());

    ConventionMapping descriptorTaskConventionMapping = new DslObject(generatePomTask).getConventionMapping();
    descriptorTaskConventionMapping.map("destination", new Callable<Object>() {
        public Object call() throws Exception {
            return new File(project.getBuildDir(), "publications/" + publication.getName() + "/pom-default.xml");
        }
    });

    // Wire the generated pom into the publication.
    publication.setPomFile(generatePomTask.getOutputs().getFiles());
}
项目:Reer    文件:MavenPublishPlugin.java   
private void createGeneratePomTask(ModelMap<Task> tasks, final MavenPublicationInternal publication, final String publicationName, final File buildDir) {
    String descriptorTaskName = "generatePomFileFor" + capitalize(publicationName) + "Publication";
    tasks.create(descriptorTaskName, GenerateMavenPom.class, new Action<GenerateMavenPom>() {
        public void execute(final GenerateMavenPom generatePomTask) {
            generatePomTask.setDescription("Generates the Maven POM file for publication '" + publicationName + "'.");
            generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            generatePomTask.setPom(publication.getPom());
            generatePomTask.setDestination(new File(buildDir, "publications/" + publication.getName() + "/pom-default.xml"));
        }
    });
    // Wire the generated pom into the publication.
    publication.setPomFile(tasks.get(descriptorTaskName).getOutputs().getFiles());
}