Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not determine Java version using executable (Java 10 build 10+44) #4503

Closed
yay opened this issue Feb 23, 2018 · 30 comments
Closed

Could not determine Java version using executable (Java 10 build 10+44) #4503

yay opened this issue Feb 23, 2018 · 30 comments

Comments

@yay
Copy link

yay commented Feb 23, 2018

Looks like a regression to me: #3892

Tested with Gradle 4.5.1 and Java 10, on macOS 10.12.6 with IntelliJ IDEA 2017.3.4 Community Edition.

The exact message when opening a gradle project is:
Could not determine Java version using executable /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java.

$ /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java --version
java 10 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+44)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+44, mixed mode)
@oehme
Copy link
Contributor

oehme commented Feb 23, 2018

I don't see why this would be a regression. The version you show above does not match the pattern before or after the change. It just never worked. See how the word "version" is missing:

java 10 2018-03-20

The pattern expects

java version 10 2018-03-20

I guess we need to make the word "version" optional too. And really we should migrate to a proper API for detecting Java versions instead of parsing an unreliable String.

@yay
Copy link
Author

yay commented Feb 23, 2018

Depends on how you look at it. From a user standpoint it's the same error (message) again. From a technical point, it's a different error.

@jasontedor
Copy link
Contributor

jasontedor commented Feb 23, 2018

I am confused here. First there is a difference between java -version and java --version:

16:44:00 [jason@totoro:~] 126 $ /usr/java/jdk-10/bin/java -version
openjdk version "10" 2018-03-20
OpenJDK Runtime Environment 18.3 (build 10+44)
OpenJDK 64-Bit Server VM 18.3 (build 10+44, mixed mode)
16:44:04 [jason@totoro:~] $ /usr/java/jdk-10/bin/java --version
openjdk 10 2018-03-20
OpenJDK Runtime Environment 18.3 (build 10+44)
OpenJDK 64-Bit Server VM 18.3 (build 10+44, mixed mode)
16:44:08 [jason@totoro:~] $ 

Note that the former includes version. From the JEP-322:

$ java -version
openjdk version \"${java.version}\" ${java.version.date}${LTS}
${java.runtime.name}${JVV} (build ${java.runtime.version})
${java.vm.name}${JVV} (build ${java.vm.version}, ${java.vm.info})
$ 

Note that version must be included in the -version output. Note that this is exactly the command that DefaultJvmVersionDetector parses the output of:

Finally, from the initial reproduction on #3892, the issue does not reproduce with the latest JDK early access download and Gradle 4.5.1:

16:47:32 [jason@totoro:~/src/jasontedor/gradle-java-version] $ cat build.gradle | grep jdk-10
def JAVA="/usr/java/jdk-10/bin/java"
def JAVAC="/usr/java/jdk-10/bin/javac"
//def JAVA="C:/java/jdk-10/bin/java.exe"
//def JAVAC="C:/java/jdk-10/bin/javac.exe"
16:47:43 [jason@totoro:~/src/jasontedor/gradle-java-version] $ /usr/java/jdk-10/bin/java -version
openjdk version "10" 2018-03-20
OpenJDK Runtime Environment 18.3 (build 10+44)
OpenJDK 64-Bit Server VM 18.3 (build 10+44, mixed mode)
16:47:54 [jason@totoro:~/src/jasontedor/gradle-java-version] $ /opt/gradle/gradle-4.5.1/bin/gradle clean build

> Task :compileJava 
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning

> Task :compileTestJava 
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning


BUILD SUCCESSFUL in 1s
5 actionable tasks: 5 executed

Note that this still fails with Gradle 4.4, as expected:

16:49:34 [jason@totoro:~/src/jasontedor/gradle-java-version] $ /opt/gradle/gradle-4.4/bin/gradle clean build

> Task :compileJava 
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning

> Task :compileTestJava 
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> Could not determine Java version using executable /usr/java/jdk-10/bin/java.

* 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

BUILD FAILED in 1s
5 actionable tasks: 5 executed
16:49:41 [jason@totoro:~/src/jasontedor/gradle-java-version] 1 $ 

So, I do not see an issue here with this particular functionality.

Would you please provide a reproduction for the actual issue that you are facing? In particular, I wonder if your IntelliJ configuration is not using Gradle 4.5.1, maybe it's using an older Gradle version? This to me is the most likely explanation. Note that if you go to: Build, Execution, Deployment > Build Tools > Gradle you can inspect the Gradle configuration. Please check this?

@jasontedor
Copy link
Contributor

I guess we need to make the word "version" optional too.

I do not think this is the issue, nor do I think this change will fix the issue reported here, nor do I think this change would be correct by the specification (JEP-322); the output of java -version must include version and it does in the latest early access release (build 44).

@bmuschko
Copy link
Contributor

I can't reproduce the issue either.

$ java -version
java version "10-ea" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10-ea+36)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10-ea+36, mixed mode)

$ gradle -v
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/bmuschko/dev/tools/gradle-4.5.1/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

------------------------------------------------------------
Gradle 4.5.1
------------------------------------------------------------

Build time:   2018-02-05 13:22:49 UTC
Revision:     37007e1c012001ff09973e0bd095139239ecd3b3

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          10-ea (Oracle Corporation 10-ea+36)
OS:           Mac OS X 10.13.3 x86_64

Executing a simple task doesn't produce a problem when parsing the Java version.

@yay Can you please try this out on the command line first? After that make sure that the IDE really uses the expected Gradle version.

@yay
Copy link
Author

yay commented Feb 27, 2018

Sorry, I have already reverted to 9.0.4 because of the issues with 10ea, but will try to give it another go in the coming days.

@jasontedor
Copy link
Contributor

You can still check what Gradle version your IDE is pointing to right now, independent of the JDK version that you’re using.

@yay
Copy link
Author

yay commented Feb 28, 2018

I'm using Gradle 4.5.1 installed via Homebrew and Use default gradle wrapper selected in IDE's settings and Delegate IDE build/run actions to gradle turned off.

I have also just downloaded the latest build of Java 10:

~ $ java --version
java 10 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+45)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+45, mixed mode)
~ $ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+45)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+45, mixed mode)
~ $ 

And I should have mentioned that I'm using Kotlin and there was an issue building or running the app with the IDE with Kotlin v1.2.21:

Error:Kotlin: [Internal Error] java.lang.ArrayIndexOutOfBoundsException: 446 Information:Kotlin: kotlinc-jvm 1.2.21 (JRE 10+45) Information:2/28/18, 14:06 - Compilation completed with 1 error and 0 warnings in 1s 224ms Error:Kotlin: [Internal Error] java.lang.ArrayIndexOutOfBoundsException: 446 at org.jetbrains.org.objectweb.asm.ClassReader.readUnsignedShort(ClassReader.java:2464) at org.jetbrains.org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:2525) at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:761) at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:646) at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:507) at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.findSystemModule(CliJavaModuleFinder.kt:44) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.access$findSystemModule(CliJavaModuleFinder.kt:25) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:37) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:25) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:149) at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:109) at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:133) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:254) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:241) at kotlin.sequences.SequencesKt___SequencesKt.none(_Sequences.kt:1239) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:227) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:230) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:409) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:286) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:276) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:109) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:53) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:381) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:97) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:895) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97) at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137) at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:925) at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:894) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:379) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:844)

With Kotlin v1.2.30 (which was apparently just released today) the IDE's build/run tasks work fine now.

But Gradle ones still don't. When I try to execute one via UI like this:

screen shot 2018-02-28 at 14 26 39

The output is the following:

14:46:32: Executing task 'build'...
Could not determine Java version using executable /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java.
14:46:32: Task execution finished 'build'.

And when I try to build from terminal I get:

Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30 $ gradle build clean --stacktrace

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'insight'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.30/kotlin-gradle-plugin-1.2.30.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.30/kotlin-gradle-plugin-1.2.30.jar
Required by:
project :

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

  • Exception is:
    org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'insight'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:66)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:667)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:136)
    at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
    at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:249)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:167)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:109)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:915)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1600(DefaultConfiguration.java:116)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:889)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:401)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
    at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:68)
    at org.gradle.internal.classpath.DefaultClassPath.(DefaultClassPath.java:48)
    at org.gradle.api.internal.initialization.DefaultScriptClassPathResolver.resolveClassPath(DefaultScriptClassPathResolver.java:39)
    at org.gradle.api.internal.initialization.DefaultScriptHandler.getScriptClassPath(DefaultScriptHandler.java:72)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.defineScriptHandlerClassScope(DefaultPluginRequestApplicator.java:204)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:82)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:184)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:61)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:58)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:64)
    ... 80 more
    Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30.
    Searched in the following locations:
    https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.30/kotlin-gradle-plugin-1.2.30.pom
    https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.30/kotlin-gradle-plugin-1.2.30.jar
    Required by:
    project :
    at org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult.notFound(DefaultBuildableComponentResolveResult.java:38)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:108)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:63)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolversChain$ComponentMetaDataResolverChain.resolve(ComponentResolversChain.java:93)
    at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:60)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState.resolve(ComponentState.java:156)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState.getMetaData(ComponentState.java:167)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.calculateTargetConfigurations(EdgeState.java:136)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.attachToTargetConfigurations(EdgeState.java:107)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.attachToTargetRevisionsSerially(DependencyGraphBuilder.java:242)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolveEdges(DependencyGraphBuilder.java:232)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:146)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:112)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.java:93)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolveGraph(DefaultConfigurationResolver.java:146)
    at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolveGraph(ShortCircuitEmptyConfigurationResolver.java:73)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:66)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$4.run(DefaultConfiguration.java:480)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:471)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:456)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1700(DefaultConfiguration.java:116)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguration.java:898)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:886)
    ... 99 more

Which is understandable, as they probably haven't updated it yet.
And probably the reason why the new stable v1.2.30 of the compiler doesn't yet show up in the stable update channel, you have to use Early Access Preview 1.2.x channel instead to get it.

@GotoFinal
Copy link

@yay After few small test, this seems to be caused by intellij, not sure why yet, but seems that this option
nah
Uses some different version of gradle than expected, like maybe intellij build-in one? Using second option will work fine, or just generating wrapper project from command line and then importing it to intellij. So this should be reported to intellij team instead.

@oehme
Copy link
Contributor

oehme commented Mar 5, 2018

I'm using Gradle 4.5.1 installed via Homebrew and Use default gradle wrapper selected in IDE's settings

You need to use the Gradle wrapper if you want to IDE to pick up the right Gradle version for your project. Otherwise it will just use the version that the IDE was built against (which is probably older).

@oehme oehme closed this as completed Mar 5, 2018
@namax
Copy link

namax commented Jun 2, 2018

I just installed gradle manually (ubuntu 16.04) and added the path to Intellij setting

selection_013

and it works fine.

@andersthorbeck
Copy link

andersthorbeck commented Jun 7, 2018

@jasontedor's solution worked for me.
I experienced this issue with gradle wrapper using gradle version 4.4.1, but once I upgraded to version 4.8, it worked fine.

@fuchao2012
Copy link

@namax's solution worked for me

mac
java@10
intelliJ 2018.1
$ brew install gradle

config gradle home to libexec path, for me it's

/usr/local/Cellar/gradle/4.8/libexec

wish help

@kennycason
Copy link

Interesting. I have the same issue using gradle 4.9/mac/intellij CE 2018.1.6 /usr/local/Cellar/gradle/4.9/libexec.

Using gradle wrapper, everything works fine: gradle wrapper --gradle-version 4.9 --distribution-type all

I'm new to gradle so this could also just be me being unfamiliar with gradle configurations.

@oehme
Copy link
Contributor

oehme commented Jul 23, 2018

Always use the Gradle wrapper.

IntelliJ (and Eclipse and Netbeans) don't care what you have installed on your system (as there is no standard location). If you don't use the wrapper, they will use whatever standard version they ship with. You can also manually configure the location on import, but that's not a great solution. The Gradle wrapper is always the way to go.

@KyLeggiero
Copy link

KyLeggiero commented Aug 31, 2018

I'm having this issue with all three ways to reference Gradle in IDEA. If I change back to Java 9.0.4 or 9.0.1, all works well. Homebrew has Gradle 4.7 installed.

After upgrading to Gradle 4.10, this seems fixed... so I must assume it was a problem with Gradle after all.

@jasonyunicorn
Copy link

@namax 's solution worked for me as well, but per @oehme 's comment to always use the Gradle wrapper, I ended up modifying the distributionUrl in the ./gradle/gradle-wrapper.properties file to something more recent. Now gradle is building properly in IntelliJ.

mac
java@10
intelliJ 2018.2.3
gradle 4.10

@aminabs
Copy link

aminabs commented Sep 14, 2018

The same java version error for me!
I upgraded gradle from 4.4.1 to version 4.10.1 and it works fine.

@Odane32
Copy link

Odane32 commented Sep 28, 2018

SOLVED for me, I was using jdk 11 and i just installed an earlier version JDK 7 and it worked

@JonasDaWi
Copy link

Had the same problem in ubuntu. Solved it by installing jdk 8 and removing jdk 11

@abhishekchotaliya
Copy link

Mac: JDK 8 and local path in Gradle worked

@rsivan
Copy link

rsivan commented Oct 17, 2018

I am on MacOS X 10.13.6, Java 11, gradle wrapper 4.10.2.
./gradlew -version shows the expected JVM 11, but printing JavaVersion.current() consistently prints 1.8!!!
I am really puzzled.

@kigawas
Copy link

kigawas commented Oct 23, 2018

Hey guys, you can try changing the gradle version here:

diff --git a/build.gradle b/build.gradle
index 6a65991..de8e547 100644
--- a/build.gradle
+++ b/build.gradle
@@ -91,5 +91,5 @@ configure(subprojects.findAll {it.name != 'util'}) {
 }

 task wrapper(type: Wrapper) {
-  gradleVersion = '4.5'
+  gradleVersion = '4.10.2'
 }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index be280be..fb7ef98 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip

@ghost
Copy link

ghost commented Nov 8, 2018

$ which gradle
/opt/gradle/bin/gradle
$ gradle --version

FAILURE: Build failed with an exception.

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

* 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
$ java --version
java 11.0.1 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
$ which java
/opt/jdk/bin/java
$ cat /etc/issue
Ubuntu 16.04.5 LTS \n \l
$ uname -a
Linux computer 4.8.4-040804-generic #201610220733 SMP Sat Oct 22 11:35:18 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ ls -lad /opt/gradle
/opt/gradle -> gradle-4.4.1

Then:

$ gradle --version --stacktrace --debug --scan
20:04:13.561 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: /home/username/.gradle/native
20:04:13.598 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.600 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
20:04:13.600 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.601 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
20:04:13.604 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not determine java version from '11.0.1'.
20:04:13.604 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.604 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
20:04:13.605 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
20:04:13.605 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.605 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
20:04:13.606 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.IllegalArgumentException: Could not determine java version from '11.0.1'.
20:04:13.607 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:72)
20:04:13.607 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.JavaVersion.current(JavaVersion.java:82)
20:04:13.607 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(UnsupportedJavaRuntimeException.java:42)
20:04:13.607 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
20:04:13.607 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:257)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:191)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.Main.doAction(Main.java:33)
20:04:13.608 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
20:04:13.609 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
20:04:13.610 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
20:04:13.610 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.610 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
20:04:13.610 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org

@DaviSpindola
Copy link

The problem can be in $JAVA_HOME. Probably the path directory is missing.

@soroushm
Copy link

soroushm commented Dec 2, 2018

change distributionUrl parameter gradle-wrapper.properties file to latest gradle version

File: "/android/gradle/wrapper/gradle-wrapper.properties"

https://gradle.org/install/

@NovaViper
Copy link

NovaViper commented Dec 11, 2018

I'm having issues with this too.. it some reason Gradle says my JAVA_HOME is set in the wrong place, despite it does find the exact path: C:\Program Files\Java\jdk1.8.0_191\

@AaronViviano
Copy link

I had the same problem described by @yay and my solution was to upgrade the project from 4.2.1 to 4.10.3 and adding JAVA_HOME to my environment variables as suggested by @NovaViper. Updating to 5.0 breaks the project I'm working with, but that's likely to be expected.

@sceee
Copy link

sceee commented Jan 5, 2019

I had the same problem after upgrading from gradle 4.10 to 5.1 and the solution by @soroushm fixed it for me.
Changing the distributionUrl in gradle/wrapper/gradle-wrapper.properties file and running .\gradlew afterwards.

@doagurugithub
Copy link

Check your SDKs or change your Intellij JDK

If you’ve upgraded a JDK recently make sure to check that the SDK paths are correct. It doesn’t have to be the SDK you’re currently using your project, it can be another version. To do this on MacOSX press F4 at the project to go to its project structure settings. Here click on SDKs and make sure that each Java JDK points to a valid folder. For example in my case the JDK 6 SDK pointed to a folder that no longer existed and once I updated that I could import the Gradle project. It’s of course also possible to delete a JDK from IntelliJ if it has been removed from disk.

On a different occasion I ran into the same problem again but this time my JDKs all seemed to be in order so I couldn’t figure out what was going on. After a good deal of trail and error I tried changing the JDK version used to start IntelliJ itself from JDK 6 to JDK 8 and this resolved the problem. To do this you need to edit the Info.plist located at /Applications/.app/Contents/Info.plist. Scroll down to the section that says JVMVersion and change its value to 1.8*. For example:

JVMVersion 1.8* Hope this will help you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests