Skip to content

Commit

Permalink
Make micrometer-bom a java-platform so it only publishes a pom
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shakuzen committed Oct 1, 2019
1 parent f03a570 commit 82d7852
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 35 deletions.
72 changes: 37 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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'

Expand All @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions micrometer-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id 'java-platform'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}

Expand All @@ -17,3 +18,11 @@ dependencyManagement {
}
}
}

publishing {
publications {
nebula(MavenPublication) {
from components.javaPlatform
}
}
}

0 comments on commit 82d7852

Please sign in to comment.