use of org.gradle.api.publish.PublishingExtension in project coffeenet-starter by coffeenet.
the class DeployedPlugin method apply.
@Override
public void apply(Project project) {
project.getPlugins().apply(MavenPublishPlugin.class);
// Create a new Maven publication
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
MavenPublication mavenPublication = publishing.getPublications().create("maven", MavenPublication.class);
mavenPublication.suppressAllPomMetadataWarnings();
// Publish all Java artifacts and the platform BOMs
// J-
// @formatter:off
project.getPlugins().withType(JavaPlugin.class).all((plugin) -> project.getComponents().matching((component) -> component.getName().equals("java")).all(mavenPublication::from));
project.getPlugins().withType(JavaPlatformPlugin.class).all((plugin) -> project.getComponents().matching((component) -> component.getName().equals("javaPlatform")).all(mavenPublication::from));
if (project.hasProperty(SIGN_GPG_PROPERTY_NAME)) {
applyGpgSigning(project, mavenPublication);
}
// @formatter:on
// J+
}
use of org.gradle.api.publish.PublishingExtension in project spring-boot by spring-projects.
the class MavenRepositoryPlugin method apply.
@Override
public void apply(Project project) {
project.getPlugins().apply(MavenPublishPlugin.class);
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
File repositoryLocation = new File(project.getBuildDir(), "maven-repository");
publishing.getRepositories().maven((mavenRepository) -> {
mavenRepository.setName("project");
mavenRepository.setUrl(repositoryLocation.toURI());
});
project.getTasks().matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME)).all((task) -> setUpProjectRepository(project, task, repositoryLocation));
project.getTasks().matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository")).all((task) -> setUpProjectRepository(project, task, repositoryLocation));
}
use of org.gradle.api.publish.PublishingExtension in project spring-boot by spring-projects.
the class MavenPublishingConventions method apply.
void apply(Project project) {
project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> {
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
if (project.hasProperty("deploymentRepository")) {
publishing.getRepositories().maven((mavenRepository) -> {
mavenRepository.setUrl(project.property("deploymentRepository"));
mavenRepository.setName("deployment");
});
}
publishing.getPublications().withType(MavenPublication.class).all((mavenPublication) -> customizeMavenPublication(mavenPublication, project));
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class);
extension.withJavadocJar();
extension.withSourcesJar();
});
});
}
use of org.gradle.api.publish.PublishingExtension in project spring-boot by spring-projects.
the class DeployedPlugin method apply.
@Override
@SuppressWarnings("deprecation")
public void apply(Project project) {
project.getPlugins().apply(MavenPublishPlugin.class);
project.getPlugins().apply(MavenRepositoryPlugin.class);
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
MavenPublication mavenPublication = publishing.getPublications().create("maven", MavenPublication.class);
project.afterEvaluate((evaluated) -> {
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
if (((Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME)).isEnabled()) {
project.getComponents().matching((component) -> component.getName().equals("java")).all((javaComponent) -> mavenPublication.from(javaComponent));
}
});
});
project.getPlugins().withType(JavaPlatformPlugin.class).all((javaPlugin) -> project.getComponents().matching((component) -> component.getName().equals("javaPlatform")).all((javaComponent) -> mavenPublication.from(javaComponent)));
}
use of org.gradle.api.publish.PublishingExtension in project gradle by gradle.
the class PublishingPlugin method apply.
@Override
public void apply(final Project project) {
RepositoryHandler repositories = publicationServices.createRepositoryHandler();
PublicationContainer publications = instantiator.newInstance(DefaultPublicationContainer.class, instantiator, collectionCallbackActionDecorator);
PublishingExtension extension = project.getExtensions().create(PublishingExtension.class, PublishingExtension.NAME, DefaultPublishingExtension.class, repositories, publications);
project.getTasks().register(PUBLISH_LIFECYCLE_TASK_NAME, task -> {
task.setDescription("Publishes all publications produced by this project.");
task.setGroup(PUBLISH_TASK_GROUP);
});
extension.getPublications().all(publication -> {
PublicationInternal<?> internalPublication = Cast.uncheckedNonnullCast(publication);
ProjectInternal projectInternal = (ProjectInternal) project;
projectPublicationRegistry.registerPublication(projectInternal, internalPublication);
});
bridgeToSoftwareModelIfNeeded((ProjectInternal) project);
validatePublishingModelWhenComplete(project, extension);
}
Aggregations