redhat-developer / redhat-developer/vscode-java

can not resolve gradle project

Open
#1,671 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Gradle
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I use vscode create a gradle project.

my settings.json is:

    "java.home": "C:\\Program Files\\Java\\openjdk-11.0.8.10-2",
    // "java.home": "C:\\Program Files\\Java\\jdk1.8.0_231",
    "java.configuration.runtimes": [
        // https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements#do-i-need-to-migrate-my-projects-to-java-11
        {
            "name": "JavaSE-1.8",
            "path": "C:\\Program Files\\Java\\jdk1.8.0_231",
            "default": true
        },
        {
            "name": "JavaSE-11",
            "path": "C:\\Program Files\\Java\\openjdk-11.0.8.10-2"
        }
    ],

my JDK_HOME environment is :

C:\Program Files\Java\jdk1.8.0_231

build.gradle is:

plugins {
	id 'org.springframework.boot' version '2.3.4.RELEASE'
	id 'io.spring.dependency-management' version '1.0.10.RELEASE'
	id 'java'
}

group = 'com.taimi'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-amqp'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation('org.springframework.boot:spring-boot-starter-test') {
		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
	}
	testImplementation 'org.springframework.amqp:spring-rabbit-test'
}

test {
	useJUnitPlatform()
}

error message is:

Could not run phased build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-6.6.1-bin.zip'.
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch: 
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files\Java\jdk1.8.0_231,daemonRegistryDir=C:\Users\fangyuan.xia\.gradle\daemon,pid=7732,idleTimeout=null,priority=NORMAL,daemonOpts=-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=a65831a7-a15f-4e83-a3e1-fa8ff27827a6,javaHome=C:\Program Files\Java\jdk1.8.0_231\jre,daemonRegistryDir=C:\Users\fangyuan.xia\.gradle\daemon,pid=16476,idleTimeout=10800000,priority=NORMAL,daemonOpts=-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

how to solve this problem

[provide a description of the issue]

Environment
  • Operating System:
  • JDK version:
  • Visual Studio Code version:
  • Java extension version:
Steps To Reproduce
  1. [step 1]
  2. [step 2]

[Please attach a sample project reproducing the error]
Please attach logs

Current Result
Expected Result
Additional Informations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied settings.json and build.gradle, then reproduce the Gradle daemon context mismatch using the reported Java and VS Code setup. Collect the missing environment details and logs, and consider the issue complete when the Gradle project resolves without the Java-home mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.