redhat-developer / redhat-developer/vscode-java

The `java.configuration.runtimes` setting seems to be shared accross different projects in different devcontainers when they run concurrently

Đang mở
#3,083 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
546
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
11

Mô tả

This issue relates to the use of redhat.java in devcontainers, and was initially reported to https://github.com/microsoft/vscode-java-dependency/issues/759. It seems however that this repository is better suited.

This issue may relate to #2543 (at least that's the closet match I could find) but I'm not sure to understand it entirely so far.
It has something to do with the fact that the java.configuration.runtimes setting is global... and cannot really be overriden... as far as I understand it.

The bug / what is happening:

When I try to open 2 different projects:

  • using 2 different devcontainer definitions,
  • using 2 different base docker containers each with 2 different versions of java (1 with oracle 1 with openjdk)
  • (re)defining specific "java.configuration.runtimes" for both devcontainers
What I expect

Then I'd expect that "java.configuration.runtimes" to be different in both dev containers and match the java version installed in the corresponding container.

What is happening

However, something strange and rather buggy happens instead:

When I get one container working, I get the following error in the OTHER container:

image

The above message is displayed in the second container although the JDK path that it mention is that of the first container.
This path is

  • NEITHER the one I defined for the second container,
  • NOR the one I'd expect when I'm running the second container.

I simply don't know what it is doing there and cannot find any reference to it in the second project.

I can have one or the other container working by dodging around, stopping / restarting containers and eventually cleaning the java server workspace but never both at once.

Even stranger:

When I choose "Open Settings" on that notification / pop-up dialog, then

  1. Select "Remote (dev container)" tab
  2. click "Edit in settings.json"
  3. vscode magically opens a settings.json file
  4. I confirm that the settings are indeed not following those specified in the devcontainer.json of the current container !
  5. I Modify the settings.json that was automagically opened and MAKE it match the expected value for its devcontainer specification
  6. Then I get the error message on the other running container !!!
    It really seems like the other container take the modification for itself as well and now complains that its java runtime does not exist (but it was working before the modification made in the other container !)

In the settings, I do not see any other redefinition of this setting (neither in the workspace settings nor in the user settings)

Conclusion: All containers seem to share the setting but I do not understand why ? and I believe that the should not in my case !

Misc information
  • VSCode Version: 1.77.3
  • Local OS Version: Windows 10 (10.0.1045 Build 19045)
  • Docker Desktop version: 4.17.1
  • Remote OS Version: custom docker image based on Rocky8.7
  • Remote Extension/Connection Type: Containers
Steps to Reproduce:
  1. Create 2 projects using devcontainers and using with different JDKs:

    It is important to note that both devcontainers use

    • different base containers, AND
    • different devcontainer.json with
    • different java.configuration.runtimes settings

    dev environment #1:

    {
        ...
        "name": "dev container #1",
        "build": {
            ...
            "target": "my-builder-java8-oracle"
        },
        ...
        "customizations": {
            "vscode": {
                "settings": {
                    "java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64",
                    // "java.configuration.maven.globalSettings": "/fit-src/settings.xml",
                    "java.configuration.maven.userSettings": "/fit-src/settings.xml",
                    "java.configuration.runtimes": [
                        {
                          "name": "JavaSE-1.8",
                          "path": "/usr/java/jdk1.8.0_351-amd64",
                          "default": true
                        }, {
                          "name": "JavaSE-17",
                          "path": "/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64"
                        }
                    ],
                    // Setting `maven.executable.options` would help with Microsoft "vscode-maven" extension but not with the CLI.
                    // see "postCreateCommand" section below.
                    // "maven.executable.options": "-o -s /fit-src/settings.xml -Dmaven.repo.local=/fit-src/maven-repo",
                    "maven.settingsFile": "/my-project/settings.xml",
                    "redhat.telemetry.enabled": false
                },
                "extensions": [
                    "ms-azuretools.vscode-docker",
                    "redhat.java",
                    "VisualStudioExptTeam.intellicode-api-usage-examples",
                    "VisualStudioExptTeam.vscodeintellicode",
                    "vscjava.vscode-java-debug",
                    "vscjava.vscode-java-dependency",
                    "vscjava.vscode-java-pack",
                    "vscjava.vscode-java-test",
                    "vscjava.vscode-maven"
                ]
            }
        }
    }
    

    and dev environment #1:

    {
        NOTE: same as above just modify the jre 1.8 path to match that of the container
        ...
        "name": "dev container #2",
        "build": {
            ...
            "target": "my-builder-java8-openjdk"
        },
        ...
        "customizations": {
            "vscode": {
                "settings": {
                    "java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64",
                    // "java.configuration.maven.globalSettings": "/fit-src/settings.xml",
                    "java.configuration.maven.userSettings": "/fit-src/settings.xml",
                    "java.configuration.runtimes": [
                        {
                          "name": "JavaSE-1.8",
                          "path": "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b09-2.el8_7.x86_64",
                          "default": true
                        }, {
                          "name": "JavaSE-17",
                          "path": "/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64"
                        }
                    ],
                    // Setting `maven.executable.options` would help with Microsoft "vscode-maven" extension but not with the CLI.
                    // see "postCreateCommand" section below.
                    // "maven.executable.options": "-o -s /fit-src/settings.xml -Dmaven.repo.local=/fit-src/maven-repo",
                    "maven.settingsFile": "/my-project/settings.xml",
                    "redhat.telemetry.enabled": false
                },
                "extensions": [
                    "ms-azuretools.vscode-docker",
                    "redhat.java",
                    "VisualStudioExptTeam.intellicode-api-usage-examples",
                    "VisualStudioExptTeam.vscodeintellicode",
                    "vscjava.vscode-java-debug",
                    "vscjava.vscode-java-dependency",
                    "vscjava.vscode-java-pack",
                    "vscjava.vscode-java-test",
                    "vscjava.vscode-maven"
                ]
            }
        }
    }
    

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Cấu hình liên quan được hiển thị trong mỗi devcontainer.json và giá trị bị ảnh hưởng được mở thông qua settings.json của Remote (dev container). Trước tiên, hãy tái hiện sự cố với hai container chạy đồng thời và so sánh các cài đặt runtime của chúng; hoàn tất khi mỗi container giữ java.configuration.runtimes riêng mà không có lỗi giữa các container.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, java, typescript, vscode
Lĩnh vực
developer-experience, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.