Gradle on OpenJDK 8: java.lang.NoSuchMethodError: java.lang.invoke.MethodHandles.privateLookupIn()

Bug #1820389 reported by Goonie
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gradle (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Cosmic
Fix Released
Undecided
Unassigned

Bug Description

[Impact]
gradle cannot be run with openjdk-8 after the update to 4.4.1-5~18.04 (bionic-proposed) or 4.4.1-5~18.10 (cosmic-proposed).

When running it with openjdk-8 gradle fails with
$ gradle -g /tmp --debug --stacktrace --foreground
<snip>
  Caused by: java.lang.NoSuchMethodError:
java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
<snip>

This is caused by the java11-compatibility patch in debian/patches, which was a incomplete backport of the upstream changes [1]. Applying the raw upstream change actually fixes the issue.

With the upstream fix applied another issue related to the ByteBuffer shows up and can be fixed by updating the java8-compatibility patch to include a cast in org.gradle.internal.hash.Hashing.update().

[Test Case]
All tests assume that bionic-proposed and cosmic-proposed are enabled.

NOTE: It is important to clear gradle files between runs as it can cache some data that will prevent or hide some issues.
$ rm -rf /tmp/native /tmp/daemon /tmp/caches/
the directories above are due to the usage of the "-g /tmp" flag.

Install gradle, openjdk-8, and openjdk-11.
$ apt install gradle openjdk-8-jdk openjdk-11-jdk default-jdk
By default gradle will use the default java (ie. java-11), check this:
$ gradle -version
<snip>
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 5 2019
JVM: 11.0.2 (Oracle Corporation 11.0.2+9-Ubuntu-3ubuntu118.04.1)
OS: Linux 4.19.0-13-generic amd64

Now run gradle with openjdk-11
$ gradle -g /tmp --debug --stacktrace --foreground

Use openjdk-8 by default
$ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

Check gradle version again
$ gradle -version
<snip>
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 5 2019
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.19.0-13-generic amd64

Clear gradle files
$ rm -rf /tmp/native /tmp/daemon /tmp/caches/

$ gradle -g /tmp --debug --stacktrace --foreground
<snip>
  Caused by: java.lang.NoSuchMethodError:
java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
<snip>

With the above fixed the following error is show and required a patch for java8-compatibility
$ gradle -g /tmp --debug --stacktrace
<snip>
01:53:01.821 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
01:53:01.822 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.hash.Hashing$MessageDigestHasher.update(Hashing.java:161)
<snip>

[Regression Potential]
The upstream fix actually enables openjdk-8 to be used again with gradle, no other regressions are expected due to that patch.

The ByteBuffer to Buffer cast is also a known fix for openjdk-8 compatibility and no regressions is expected.

[Other Info]
References:
[1] https://github.com/gradle/gradle/commit/028548460bd929fd034a552704798ad7f689493a

[Original bug report]
Just tried the proposed Gradle package on Ubuntu 18.04 LTS. As I cannot yet use OpenJDK 11, I switched all Java alternatives back to OpenJDK 8 using

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

Now, when I try to build my project I get the above generic error. Full console output:

$ gradle --no-daemon clean installDebug
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

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

* Get more help at https://help.gradle.org

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

* Get more help at https://help.gradle.org

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gradle 4.4.1-5~18.04
ProcVersionSignature: Ubuntu 4.18.0-16.17~18.04.1-generic 4.18.20
Uname: Linux 4.18.0-16-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Mar 16 11:56:15 2019
EcryptfsInUse: Yes
InstallationDate: Installed on 2016-04-21 (1058 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
PackageArchitecture: all
SourcePackage: gradle
UpgradeStatus: Upgraded to bionic on 2018-04-26 (323 days ago)

Revision history for this message
Goonie (goonie) wrote :
Revision history for this message
Andreas Schildbach (schildbach) wrote :
Download full text (4.5 KiB)

The full exception is.

java.lang.ExceptionInInitializerError
        at org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:48)
        at org.gradle.initialization.DefaultClassLoaderRegistry.restrictTo(DefaultClassLoaderRegistry.java:40)
        at org.gradle.initialization.DefaultClassLoaderRegistry.restrictToGradleApi(DefaultClassLoaderRegistry.java:36)
        at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:30)
        at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:207)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:795)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:748)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:574)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:623)
        at org.gradle.internal.service.DefaultServiceRegistry.applyConfigureMethod(DefaultServiceRegistry.java:199)
        at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:180)
        at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:255)
        at org.gradle.internal.service.ServiceRegistryBuilder.build(ServiceRegistryBuilder.java:52)
        at org.gradle.launcher.cli.BuildActionsFactory.runBuildInProcess(BuildActionsFactory.java:129)
        at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:90)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:296)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:286)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:264)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:257)
        at org.gradle.launcher...

Read more...

summary: - java.lang.ExceptionInInitializerError (no error message)
+ Gradle on OpenJDK 8: java.lang.NoSuchMethodError:
+ java.lang.invoke.MethodHandles.privateLookupIn()
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gradle (Ubuntu):
status: New → Confirmed
Revision history for this message
Andreas Schildbach (schildbach) wrote :

I just compared the Gradle 4.4.1 in bionic-proposed against a manually installed Gradle 4.4.1. The manual install doesn't have this bug!

For reference:

$ gradle --version

------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------

Build time: 2012-12-21 00:00:00 UTC
Revision: none

Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.10.3 compiled on July 19 2018
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.18.0-16-generic amd64

$ ~/dev/gradle-4.4.1/bin/gradle --version

------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------

Build time: 2017-12-20 15:45:23 UTC
Revision: 10ed9dc355dc39f6307cc98fbd8cea314bdd381c

Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.18.0-16-generic amd64

Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

The important error in the log is:

  Caused by: java.lang.NoSuchMethodError:
java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;

which in turn is caused by the debian/patches/java11-compatibility.patch that introduces a patch to handle the missing unsafe features from OpenJDK 11 by using MethodHandles instead. Unfortunately this means that gradle won't work with OpenJDK 8 until this patch is reworked.

tags: added: bot-stop-nagging
Revision history for this message
Andreas Schildbach (schildbach) wrote :

@Tiago But can this be fixed *before* Gradle 4.4.1 is released to bionic-updates? I expect this will break many setups, certainly not what you'd expect for a LTS release.

Steve Langasek (vorlon)
tags: added: regression-proposed
description: updated
Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

We have a fix for this issue, it is pending some internal review. I expect it to be available in the proposed pocket in less than a day. An automated message will be added to this bug when it is available for testing, we would highly appreciate any testing and reports on the fix.

Please notice that gradle keeps some local cache that might interfere with the testing, so do remove .gradle/, native/, daemon/, and caches/ directories if the error still shows up and test it again.

Revision history for this message
Andreas Schildbach (schildbach) wrote :

Thanks a lot! I'm happy to test any new proposed packages and will report back the findings.

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Goonie, or anyone else affected,

Accepted gradle into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gradle/4.4.1-5~18.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gradle (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Goonie, or anyone else affected,

Accepted gradle into cosmic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gradle/4.4.1-5~18.10.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gradle (Ubuntu Cosmic):
status: New → Fix Committed
tags: added: verification-needed-cosmic
Revision history for this message
Andreas Schildbach (schildbach) wrote :
Download full text (4.9 KiB)

I just installed gradle 4.4.1-5~18.04 and moved ~/.gradle to ~/.gradle.bak (actually it's a dangerous suggestion to remove that directory, because it can contain user settings).

Issue 1: The hard dependency to OpenJDK 11 is still there. I can't uninstall OpenJDK 11 without uninstalling gradle.

So I switched to Java 8 by running

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

Issue 2: Then I tried "gradle --stacktrace clean" on all of my projects. The exception is slightly different from before, but still kind of similar. The stacktrace doesn't seem complete, I'm not sure why this is the case. Please let me know how to acquire a full stacktrace if you need it.

$ gradle --stacktrace clean
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

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

* Get more help at https://help.gradle.org

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleException: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

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

* Get more help at https://help.gradle.org

        at org.gradle.launcher.daemon.bootstrap.DaemonGreeter.parseDaemonOutput(DaemonGreeter.java:34)
        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:152)
        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:135)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.doStartDaemon(DefaultDaemonConnector.java:210)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:204)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:128)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:138)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:92)
        at org.gradle.launc...

Read more...

tags: added: verification-failed-bionic
removed: verification-needed-bionic
description: updated
Revision history for this message
Andreas Schildbach (schildbach) wrote :

On Ubuntu Cosmic, I installed gradle 4.4.1-5~18.10.1, also moved ~/.gradle out of the way and used update-java-alternatives to make OpenJDK 8 the default.

I tested 3 Java and 2 Android projects and all build fine. There are some additional warnings about features that will be removed with Gradle 5 but that's fine.

Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

Please rerun it with the --foreground option as it should show what is going on with the daemon. Without that the daemon starts on the background and you will only see the exception from the failure about interacting with the daemon.

The --debug option might also help as it shows how the daemon is being started on background - in this case don't use the --foreground flag. This command allows one to copy&paste the command to start a gradle daemon on a separated terminal, that daemon can then be used by running
$ gradle --no-daemon --stacktrace [other args/flags]

Revision history for this message
Andreas Schildbach (schildbach) wrote :
Download full text (4.6 KiB)

This is about Bionic again. Thanks for mentioning the daemon. I ran

$ gradle --no-daemon --stacktrace clean

The full exception is:

java.lang.ExceptionInInitializerError
        at org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:48)
        at org.gradle.initialization.DefaultClassLoaderRegistry.restrictTo(DefaultClassLoaderRegistry.java:40)
        at org.gradle.initialization.DefaultClassLoaderRegistry.restrictToGradleApi(DefaultClassLoaderRegistry.java:36)
        at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:30)
        at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:207)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:795)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:748)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:574)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:623)
        at org.gradle.internal.service.DefaultServiceRegistry.applyConfigureMethod(DefaultServiceRegistry.java:199)
        at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:180)
        at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:255)
        at org.gradle.internal.service.ServiceRegistryBuilder.build(ServiceRegistryBuilder.java:52)
        at org.gradle.launcher.cli.BuildActionsFactory.runBuildInProcess(BuildActionsFactory.java:129)
        at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:90)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:296)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:286)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:264)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli....

Read more...

tags: added: verification-done-cosmic
removed: verification-needed-cosmic
Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

Also, we need a reproducer for this. Could you please check the smallest gradle project, with no external dependencies, that fails under test and report back on how to get it?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gradle - 4.4.1-5ubuntu1

---------------
gradle (4.4.1-5ubuntu1) disco; urgency=medium

   * Fix OpenJDK 8 compatibility: (LP: #1820389)
     - debian/patches/java8-compatibility.patch: cast ByteBuffer to Buffer
       in org.gradle.internal.hash.Hashing to prevent NoSuchMethodError
       exception.
     - debian/patches/java11-compatibility.patch: copy upstream commit for
       "Use Lookup to invoke defineClass on Java 9+ (#4976)" instead using
       the previous partial backport to enable both OpenJDK 8 and 11 support.

 -- Tiago Stürmer Daitx <email address hidden> Fri, 15 Mar 2019 21:31:21 +0000

Changed in gradle (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Andreas Schildbach (schildbach) wrote :

@Tiago: I just tried and the smallest possible project is the empty directory.

Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

I can't reproduce this. In an empty directory I get:
$ mkdir empty
$ cd empty
$ gradle --stacktrace --debug -g /tmp clean
<snip>
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
FAILURE: Build failed with an exception.
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
* What went wrong:
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
Task 'clean' not found in root project 'asd'.
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
* Try:
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
Run gradle tasks to get a list of available tasks. Run with --scan to get full insights.
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
* Exception is:
18:33:49.406 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
org.gradle.execution.TaskSelectionException: Task 'clean' not found in root project 'asd'.
<snip>

And on a very small gradle project with no external dependencies I get a "BUILD SUCCESSFUL in 0s"
$ git clone https://github.com/jabedhasan21/java-hello-world-with-gradle.git
$ gradle --stacktrace --debug -g /tmp clean
<snip>
18:37:34.955 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD SUCCESSFUL in 0s
<snip>

Please make sure you don't have any gradle daemon or java processes running
$ pgrep -a gradle
$ pgrep -a java

and kill them if needed
$ pkill -9 gradle
$ pkill -9 java

And that the cache, daemon, and native directories have been removed (I am forcefully creating them in /tmp through the '-g /tmp' parameter):
$ rm -rf /tmp/cache /tmp/daemon /tmp/native

Also please confirm that you are running the right gradle version:
$ gradle -version
<snip>
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 5 2019
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.19.0-13-generic amd64
<snip>

$ apt policy gradle
gradle:
  Installed: 4.4.1-5~18.04.1
  Candidate: 4.4.1-5~18.04.1
  Version table:
 *** 4.4.1-5~18.04.1 500
        500 http://localhost:9999/ubuntu-br bionic-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     3.4.1-7ubuntu1 500
        500 http://localhost:9999/ubuntu-br bionic/universe amd64 Packages

Revision history for this message
Andreas Schildbach (schildbach) wrote :

I rebooted my machine and now everything works. Not sure where the old code was hiding.

tags: added: verification-done-bionic
removed: verification-failed-bionic
Revision history for this message
Andreas Schildbach (schildbach) wrote :

See https://bugs.launchpad.net/ubuntu/+source/gradle/+bug/1797761 for the remaining issue with the alternative dependency declaration.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.7 KiB)

This bug was fixed in the package gradle - 4.4.1-5ubuntu2~18.04

---------------
gradle (4.4.1-5ubuntu2~18.04) bionic; urgency=medium

  * Backport from Disco. (LP: #1814133)

gradle (4.4.1-5ubuntu2) disco; urgency=medium

  * debian/control: revert gradle Depends back to java 8 as the previous
    update fixed java 8 compatibility and allowed gradle to be run with
    openjdk-8. (LP: #1797761)

gradle (4.4.1-5ubuntu1) disco; urgency=medium

   * Fix OpenJDK 8 compatibility: (LP: #1820389)
     - debian/patches/java8-compatibility.patch: cast ByteBuffer to Buffer
       in org.gradle.internal.hash.Hashing to prevent NoSuchMethodError
       exception.
     - debian/patches/java11-compatibility.patch: copy upstream commit for
       "Use Lookup to invoke defineClass on Java 9+ (#4976)" instead using
       the previous partial backport to enable both OpenJDK 8 and 11 support.

gradle (4.4.1-5) unstable; urgency=medium

  * Team upload.
  * Generate a very basic manpage in POD format.
  * Use ASM7 instead of ASM6 to better support Java 11 (Closes: #923284).
  * Bump libasm-java dependency to 7.0.

gradle (4.4.1-4) unstable; urgency=medium

  * Team upload.
  * Removed the unused dependency on libtomcat8-java
  * Standards-Version updated to 4.3.0

gradle (4.4.1-3) unstable; urgency=medium

  * Team upload.
  * Add build-dep on libjaxp1.3-java (addresses FTBFS)

gradle (4.4.1-2) unstable; urgency=medium

  * Improve OpenJDK 11 support by backporting additional changes from upstream
    (commit ac15612d41b43c39c).

gradle (4.4.1-1) unstable; urgency=medium

  * Team upload.
  * New upstream release
    - Refreshed the patches
  * Fixed the build failure with Java 11 (Closes: #909905)
  * Depend on Java 9+

gradle (4.4-3) unstable; urgency=medium

  * Team upload.
  * Fixed the build failure with asm/6.2.1

gradle (4.4-2) unstable; urgency=medium

  * Team upload.
  * Upload to unstable
  * Updated the gradle-debian-helper-hook patch for Gradle 4.4
  * Added a system property to disable the gradle-debian-helper hook
  * Declare that Gradle 4.4 breaks gradle-debian-helper (<< 2.0~)
  * Declare that libgradle-plugins-java breaks libgradle-core-java < 4.4
    (Closes: #903775)

gradle (4.4-1) experimental; urgency=medium

  * New upstream release
  * Remove 2 additional source files that are no longer needed
    * jQuery.tipTip.js -- No longer build User Guide
    * all-released-versions.js -- Included in upstream
  * Add prebuilt files:
    * api-mapping.txt default-imports.txt -- They will be built from this
      package once this version is uploaded.
    * oss-parent-debian.pom -- Bypass the error (#899005) resolving `findbugs`
  * Move `gradle-wrapper` from `libgradle-plugins-java` to
    `libgradle-core-java` to be consistent with upstream.
  * Remove obsolete patches:
    * add-test-case-for-10-internal_c1fe5e40a76b.patch
    * commons-io.patch
    * dependency-management_depends_on_testkit.patch
    * disallow-both-module-source-path-and-source-path.patch
    * Groovy_projects_depends_on_localGroovy.patch
    * jansi.patch
    * nekohtml.patch
    * new_APIs_in_3.0.patch
    * support-running-gradle-on-jdk-10-500485df3a18.patch
    * support-...

Read more...

Changed in gradle (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gradle - 4.4.1-5ubuntu2~18.10

---------------
gradle (4.4.1-5ubuntu2~18.10) cosmic; urgency=medium

  * Backport from Disco. (LP: #1814133)

gradle (4.4.1-5ubuntu2) disco; urgency=medium

  * debian/control: revert gradle Depends back to java 8 as the previous
    update fixed java 8 compatibility and allowed gradle to be run with
    openjdk-8. (LP: #1797761)

gradle (4.4.1-5ubuntu1) disco; urgency=medium

   * Fix OpenJDK 8 compatibility: (LP: #1820389)
     - debian/patches/java8-compatibility.patch: cast ByteBuffer to Buffer
       in org.gradle.internal.hash.Hashing to prevent NoSuchMethodError
       exception.
     - debian/patches/java11-compatibility.patch: copy upstream commit for
       "Use Lookup to invoke defineClass on Java 9+ (#4976)" instead using
       the previous partial backport to enable both OpenJDK 8 and 11 support.

gradle (4.4.1-5) unstable; urgency=medium

  * Team upload.
  * Generate a very basic manpage in POD format.
  * Use ASM7 instead of ASM6 to better support Java 11 (Closes: #923284).
  * Bump libasm-java dependency to 7.0.

gradle (4.4.1-4) unstable; urgency=medium

  * Team upload.
  * Removed the unused dependency on libtomcat8-java
  * Standards-Version updated to 4.3.0

gradle (4.4.1-3) unstable; urgency=medium

  * Team upload.
  * Add build-dep on libjaxp1.3-java (addresses FTBFS)

gradle (4.4.1-2) unstable; urgency=medium

  * Improve OpenJDK 11 support by backporting additional changes from upstream
    (commit ac15612d41b43c39c).

 -- Tiago Stürmer Daitx <email address hidden> Thu, 21 Mar 2019 12:31:32 +0000

Changed in gradle (Ubuntu Cosmic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.