use of org.gradle.api.publish.PublicationContainer in project shipkit by mockito.
the class JavaPublishPlugin method apply.
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
project.getPlugins().apply(JavaLibraryPlugin.class);
project.getPlugins().apply("maven-publish");
final Jar sourcesJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.SOURCES_JAR_TASK);
final Jar javadocJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.JAVADOC_JAR_TASK);
GradleDSLHelper.publications(project, new Action<PublicationContainer>() {
public void execute(PublicationContainer publications) {
MavenPublication p = publications.create(PUBLICATION_NAME, MavenPublication.class, new Action<MavenPublication>() {
public void execute(MavenPublication publication) {
publication.from(project.getComponents().getByName("java"));
publication.artifact(sourcesJar);
publication.artifact(javadocJar);
publication.setArtifactId(((Jar) project.getTasks().getByName("jar")).getBaseName());
PomCustomizer.customizePom(project, conf, publication);
}
});
LOG.info("{} - configured '{}' publication", project.getPath(), p.getArtifactId());
}
});
// so that we flesh out problems with maven publication during the build process
project.getTasks().getByName("build").dependsOn("publishToMavenLocal");
}
Aggregations