From 82d78528fb71c16d4483ae61bde327eb82e74c76 Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Tue, 1 Oct 2019 03:54:43 -0400 Subject: [PATCH] Make micrometer-bom a java-platform so it only publishes a pom The nebula publication was publishing source, javadoc, and binary jars along with the pom. The correct way to just publish a pom (BOM) in Gradle is to use the `java-platform` plugin. This requires that the project not be a `java` or `java-library` project. Resolves #1618 --- build.gradle | 72 +++++++++++++++++++------------------ micrometer-bom/build.gradle | 9 +++++ 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index a4fabf3cd1..10aac6f6d7 100644 --- a/build.gradle +++ b/build.gradle @@ -27,8 +27,43 @@ allprojects { } subprojects { - apply plugin: 'java' - apply plugin: 'checkstyle' + if (project.name != 'micrometer-bom') { + apply plugin: 'java' + apply plugin: 'checkstyle' + + tasks { + compileJava { + options.encoding = 'UTF-8' + // ensure Java 8 baseline is enforced for main source + if (JavaVersion.current().isJava9Compatible()) { + options.compilerArgs.addAll(['--release', '8']) + } + } + compileTestJava { + options.encoding = 'UTF-8' + sourceCompatibility = JavaVersion.current() + targetCompatibility = JavaVersion.current() + } + } + + //noinspection GroovyAssignabilityCheck + test { + // set heap size for the test JVM(s) + maxHeapSize = "1500m" + + useJUnitPlatform() + } + + checkstyle { + toolVersion = '8.23' + configFile = rootProject.file('config/checkstyle/checkstyle.xml') + } + + license { + ext.year = Calendar.getInstance().get(Calendar.YEAR) + skipExistingHeaders = true + } + } dependencyLocking { lockAllConfigurations() @@ -49,21 +84,6 @@ subprojects { } } - tasks { - compileJava { - options.encoding = 'UTF-8' - // ensure Java 8 baseline is enforced for main source - if (JavaVersion.current().isJava9Compatible()) { - options.compilerArgs.addAll(['--release', '8']) - } - } - compileTestJava { - options.encoding = 'UTF-8' - sourceCompatibility = JavaVersion.current() - targetCompatibility = JavaVersion.current() - } - } - if(!['samples', 'benchmarks'].find{project.name.contains(it)}) { apply plugin: 'io.spring.publishing' @@ -87,26 +107,8 @@ subprojects { mavenLocal() } - checkstyle { - toolVersion = '8.23' - configFile = rootProject.file('config/checkstyle/checkstyle.xml') - } - def check = tasks.findByName('check') if (check) project.rootProject.tasks.releaseCheck.dependsOn check - - //noinspection GroovyAssignabilityCheck - test { - // set heap size for the test JVM(s) - maxHeapSize = "1500m" - - useJUnitPlatform() - } - - license { - ext.year = Calendar.getInstance().get(Calendar.YEAR) - skipExistingHeaders = true - } } wrapper { diff --git a/micrometer-bom/build.gradle b/micrometer-bom/build.gradle index 87ebce3d78..0448ea5d3b 100644 --- a/micrometer-bom/build.gradle +++ b/micrometer-bom/build.gradle @@ -1,4 +1,5 @@ plugins { + id 'java-platform' id 'io.spring.dependency-management' version '1.0.8.RELEASE' } @@ -17,3 +18,11 @@ dependencyManagement { } } } + +publishing { + publications { + nebula(MavenPublication) { + from components.javaPlatform + } + } +}