Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
Fail the build when using the wrong java version for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusAmshove committed Oct 22, 2022
1 parent 2ceebe1 commit 00581a0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ subprojects {
apply plugin: 'java'
apply plugin: 'signing'


project.tasks['classes'].dependsOn(checkJavaVersion)


artifactName = artifactName ?: project.name

task sourcesJar(type: Jar, dependsOn: classes) {
Expand Down Expand Up @@ -130,3 +134,14 @@ subprojects {
}
}
}

task checkJavaVersion {
doLast {
def currentJvm = org.gradle.internal.jvm.Jvm.current()
if(!currentJvm.toString().startsWith('1.8'))
{
throw new RuntimeException("For publishing, JAVA_HOME needs to point to Java 8")
}
}
}

0 comments on commit 00581a0

Please sign in to comment.