Skip to content

Running test causes repeated Java rebuilds #1839

@kropptrevor

Description

@kropptrevor

The problem is that when running a test, for some reason, this causes the Java build server to rebuild repeatedly. Every time that happens, it causes the tests to reload also.

On larger projects, this rebuild gets rather violent. I suspect this may be because the rebuild is trigger for each subproject, as the time between rebuilds is much shorter on larger projects. This requires a cleaning of the Java workspace entirely, as it will slow down the system to a crawl.

This might be related to #1787.

Sample project to replicate:

Steps to replicate:

  • Install the extensions
  • Clean the Java workspace
  • Open LinkedListTest.java
  • Run any test
  • Observe the Testing tab

Workaround:

  • Set "java.gradle.buildServer.enabled": "off",

Other problems I noticed:

  • Missing classpath entries had to be fixed with java.test.config (in the sample project, {workspace}/sample-file/build/custom-libs/sample.jar was missing which works when running the test from the command line)
  • Sometimes a classpath entry will be truncated to be incorrect absolute paths, e.g., /sample-bad-classpath/list/bin

Setup:

  • Java 21 (Corretto)
  • Gradle 9.3.1
  • WSL 2.6.3.0
  • Ubuntu 24.04.4
  • VSCode 1.109.5
  • WSL VSCode Extensions:
    • Container Tools - ms-azuretools.vscode-containers - version 2.4.1
    • Debugger for Java - vscjava.vscode-java-debug - version 0.58.5
    • Gradle for Java - vscjava.vscode-gradle - version 3.17.2
    • Language Support for Java(TM) by Red Hat - redhat.java - version 1.52.0
    • Partial Diff - ryu1kn.partial-diff - version 1.4.3
    • Test Runner for Java - vscjava.vscode-java-test - version 0.44.0
    • XML - redhat.vscode-xml - version 0.29.0
  • Windows VSCode Extensions:
    • vscode-icons - vscode-icons-team.vscode-icons - version 12.17.0
    • WSL - ms-vscode-remote.remote-wsl - version 0.104.3

Remote settings.json:

    "[java]": {
        "editor.pasteAs.enabled": false,
    },
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-17",
            "path": "/usr/lib/jvm/java-17-amazon-corretto"
        },
        {
            "name": "JavaSE-21",
            "path": "/usr/lib/jvm/java-21-amazon-corretto"
        },
    ],
    "java.jdt.ls.java.home": "/usr/lib/jvm/java-21-amazon-corretto",
    "java.import.gradle.java.home": "/usr/lib/jvm/java-21-amazon-corretto",

Please let me know if I need to create the issue on another repository instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions