Gradle 5

In diesem Beitrag möchte ich auf die Änderungen der bevorstehenden Release von Gradle 5 eingehen. Aktuell ist das 3. Release Candidate veröffentlicht.

Update des Wrappers

Der Wrapper läßt sich wie immer mit wrapper –gradle-version updaten. Etwas verwirrend ist hier das Versionsschema. Es ist mit GIT v5.0.0-RC3 getagt, aber die Version heißt 5.0-rc-3!

./gradlew wrapper --gradle-version=5.0-rc-3

Was gibt es neues in Gradle 5.0

Java 11 Support

Nun kann man endlich Gradle mit Java 11 verwenden. Mit Versionen kleiner 5.0 konnten in einer Java 11 Umgebung keine Builds ausgeführt werden. Es gab diverse Fehlermeldungen.

$ ./gradlew -version

------------------------------------------------------------
Gradle 5.0-rc-3
------------------------------------------------------------

Build time:   2018-11-14 16:01:47 UTC
Revision:     63f11c722124617f7cbe2f95ad5a5e045b8b42f6

Kotlin DSL:   1.0.3
Kotlin:       1.3.0
Groovy:       2.5.3
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
OS:           Linux 4.19.1-1-MANJARO amd64

Was wurde deprecated

Annotation Prozessoren auf dem Klassenpfad

Verwendet man Project Lombok, dann läuft man potenziell Gefahr auf diese Meldung zu stoßen, wenn man einen build mit Warnhinweisen anstößt.

$ ./gradlew --warn --warning-mode=all build


Detecting annotation processors on the compile classpath has been deprecated. Gradle 5.0 will ignore annotation processors on the compile classpath. The following annotation processors were detected on the compile classpath: 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor' and 'lombok.launch.AnnotationProcessorHider$ClaimingProcessor'.  Please add them to the annotation processor path instead. If you did not intend to use annotation processors, you can use the '-proc:none' compiler argument to ignore them.

Gradle möchte ab Version 4, dass ein Annotation Processor in der Konfiguration annotationProcessor hinterlegt wird. Also muss in den Dependencies compileOnly und annotationProcessor wie folgt angegeben werden:

// Project Lombok
// Since Gradle warns if an AnnotationProcessor is found on classpath, put 
// it into annotationProcessor directive
compileOnly('org.projectlombok:lombok')
annotationProcessor('org.projectlombok:lombok')