skip to Main Content

When working in a terminal with gradle 5.6.1 many things work as expected. E.g. changing to an older java version (1). If I change to gradle 3.4 gradle does not find the jdk any more (1).

How do I get gradle 3.4 working on my system again.

I would like build a project I once made with gradle 3.4. However, I have no gradle wrapper and the build seems broken due to changes to gradle 5.6.1.

(1)

user@system:~$ sdk u gradle 3.4                                                                      

Using gradle version 3.4 in this shell.                                                                           
user@system:~$ gradle -v                                                                             

FAILURE: Build failed with an exception.                                                                          

* What went wrong:                                                                                                
Could not determine java version from '11.0.5'.                                                                   

* Try:                                                                                                            
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
user@system:~$ sdk u java 9.0.4

Stop! java 9.0.4 is not available. Possible causes:
 * 9.0.4 is an invalid version
 * java binaries are incompatible with Linux64
 * java has not been released yet
user@system:~$ sdk u java 9.0.4-open

Using java version 9.0.4-open in this shell.
user@system:~$ gradle

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

(2)

user@system:~$ gradle -v                                                                                         
                                                                                                                      ------------------------------------------------------------                                                      
Gradle 5.6.1                                                                                                      
------------------------------------------------------------                                                      

Build time:   2019-08-28 02:49:34 UTC                                                                             
Revision:     b6bd8e7934ca41d9e52610058aa7cb834df81fc4                                                            

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019                                            
JVM:          11.0.5 (Debian 11.0.5+10-post-Debian-1deb10u1)                                                     
OS:           Linux 4.19.0-6-amd64 amd64

user@system:~$ sdk u java 9.0.4-open

Using java version 9.0.4-open in this shell.
user@system:~$ gradle -v
------------------------------------------------------------                                                     
Gradle 5.6.1
------------------------------------------------------------                                                     

Build time:   2019-08-28 02:49:34 UTC
Revision:     b6bd8e7934ca41d9e52610058aa7cb834df81fc4

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          9.0.4 (Oracle Corporation 9.0.4+11)
OS:           Linux 4.19.0-6-amd64 amd64

2

Answers


  1. Gradle supports Java 11 (and 10) only as of Gradle version 4.7, also see https://github.com/gradle/gradle/issues/4591. Java 9 is supported as of Gradle 4.1. So your best option is to try whether Gradle 4.7 works out of the box for you, or alternatively make your build compatible with the current Gradle version.

    Login or Signup to reply.
  2. Different versions of Gradle support running on different versions of Java. And from what I can tell, you need Gradle 4.2.1 to fully support Java 9. Are you sure this is the combination you used on your old project? If so, you may want to try the initial release of Java 9 (without any point releases). If it just fails in the version parsing, it might help. But I am pretty sure there are other problems with that combination.

    In any case, you need to either upgrade Gradle from 3.4 or downgrade Java from 9.0.4.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search