We should update the installed gradle to the latest released version.
I just tried to work with the currently installed gradle version (4.4.1) but don't succeed.
I can run a
gradle --version
but even a simple
gradle tasks
produces an error which I can't handle:
Picked up JAVA_TOOL_OPTIONS: -Xmx3189m
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:
-----------------------
Picked up JAVA_TOOL_OPTIONS: -Xmx3189m
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
when I run gradle --no-daemon --stacktrace I get
Picked up JAVA_TOOL_OPTIONS: -Xmx3189m
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* 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.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:191)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
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.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
at org.gradle.internal.classloader.ClassLoaderUtils.<clinit>(ClassLoaderUtils.java:46)
... 39 more
Caused by: java.lang.NoSuchMethodError: java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
at org.gradle.internal.classloader.ClassLoaderUtils.<clinit>(ClassLoaderUtils.java:43)
... 39 more
* Get more help at https://help.gradle.org
Something in grade tries to call java.lang.invoke.MethodHandles.privateLookupIn(Class, Lookup) , but that method was introduced in Java9 and we have Java8 installed.
Gradle itself is happy with Java8, according to the docs.
workaround: use ./gradlew
workaround works - I installed gradle through sdkman.io and initialized the gradle wrapper...
I just wonder if it would make sense to have sdkman.io in the standard container. It lets you easily install various versions of various tools....
I just tried sdkman.io in gitpod as well:
curl -s https://get.sdkman.io | bashsource "/home/gitpod/.sdkman/bin/sdkman-init.sh"sdk install gradleand gradle -version outputs Welcome to Gradle 5.0!.
I found it because Gradle officially supports it.
It makes sense to use it in the standard container because it can manage Java, Gradle and Maven in the user-space, just as we already do it for node via nvm. Also, it seems to more up-to-date than Debian/Ubuntu apt packages.
I'll look into fixing this in https://github.com/gitpod-io/workspace-images/blob/master/full/Dockerfile directly. Thanks for the sdkman.io suggestion!
I guess we could use either https://sdkman.io or https://linuxbrew.sh here:
I'll do some more research and experiments, but I'm open to suggestions/preferences.
I ran into a few bugs with Linuxbrew, so I went with SDKMAN to install Gradle and Maven.
I'd still like to install Linuxbrew though, because it would allow installing basically any package in Gitpod without sudo.
Most helpful comment
I just tried sdkman.io in gitpod as well:
curl -s https://get.sdkman.io | bashsource "/home/gitpod/.sdkman/bin/sdkman-init.sh"sdk install gradleand
gradle -versionoutputsWelcome to Gradle 5.0!.I found it because Gradle officially supports it.
It makes sense to use it in the standard container because it can manage Java, Gradle and Maven in the user-space, just as we already do it for
nodevianvm. Also, it seems to more up-to-date than Debian/Ubuntu apt packages.