Tech Blog

Conflicts and Workarounds When Developing Java with VS Code + GitHub Copilot

by Tech Writer
VS Code GitHub Copilot Java Spring Boot

Introduction

When developing Java in VS Code, multiple extensions run simultaneously,
which can cause unexpected interference and conflicts.

These combinations in particular required attention:

  • Language Support for Java (by Red Hat)
  • GitHub Copilot / GitHub Copilot Chat
  • Spring Boot Extension Pack
  • Maven Wrapper + project-internal Node configuration

This article is a record of the actual problems encountered and their workarounds.


① Problem: run_in_terminal Gets Absorbed by jshell

Symptom

When trying to run commands in the VS Code terminal,
input accidentally flows into a jshell (Java’s REPL) session that’s already running.

Cause

The Language Support for Java extension sometimes opens a jshell session at startup,
which conflicts with the active terminal.

Workaround

Run commands through VS Code Tasks (tasks.json).

// .vscode/tasks.json
{
  "tasks": [
    {
      "label": "build-skip-tests",
      "type": "shell",
      "command": ".\\mvnw.cmd",
      "args": ["-DskipTests", "package"],
      "options": {
        "cwd": "${workspaceFolder}"
      }
    }
  ]
}

Tasks run in an independent shell, so they’re not affected by jshell interference.


② Java Language Server Picks Up an Old JDK

Symptom

Java 21 is specified in pom.xml, but
code errors are displayed by Java 11 rules.

Cause

The JDK used by VS Code’s Java Language Server and
the project’s compilation target don’t match.

How to Check

Command Palette (Ctrl+Shift+P) → Java: Configure Java Runtime

Check if “Project JDK” is showing the correct version

Workaround

Explicitly specify the JDK in .vscode/settings.json.

// .vscode/settings.json
{
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-21",
      "path": "C:\\Program Files\\Java\\jdk-21",
      "default": true
    },
    {
      "name": "JavaSE-25",
      "path": "C:\\Program Files\\Java\\jdk-25"
    }
  ],
  "java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-21"
}

③ Copilot Chat’s Agent Mode Occupies the Terminal

Symptom

When Copilot Agent executes commands,
input may be sent to an already open terminal session.
If jshell is running, mvn commands get interpreted as jshell input.

Workaround

  • If jshell is running in the terminal, exit with :exit
  • When requesting command execution from Copilot Agent,
    either open a new terminal before requesting, or ask it to run via a task

④ Annotation Processor Configuration When Using Lombok

Symptom

Lombok annotations like @Getter, @Builder show red underlines.
The compilation succeeds but the error display won’t go away.

Workaround

// .vscode/settings.json
{
  "java.compile.nullAnalysis.mode": "disabled",
  "java.configuration.updateBuildConfiguration": "automatic"
}

Also, check that the Lombok dependency is correctly added to pom.xml:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <optional>true</optional>
</dependency>

⑤ Spring Boot DevTools + Copilot Auto-Complete Conflicts

Symptom

Hot reload by Spring Boot DevTools runs frequently,
and Copilot’s completions get reset midway.

Approach

During development, keep DevTools enabled,
but temporarily stop the app when doing large completions (class generation, etc.).

Narrowing the DevTools restart triggers is also effective:

# application-local.yml
spring:
  devtools:
    restart:
      additional-exclude: "**/*.html,**/*.css,**/*.js"

⑥ Java Language Server Conflicts in Multi-Root Workspaces

Symptom

When opening multiple Spring Boot projects (admin / customer-app) in the same VS Code window,
the Language Server sometimes doesn’t recognize each project separately,
causing classes from one project to be invisible.

Cause

It can take time for Java Language Server to recognize each project.

Workaround

Define the multi-root workspace using a .code-workspace file.

// dvd-rental.code-workspace
{
  "folders": [
    {
      "name": "admin",
      "path": "C:\\Users\\y_104\\git\\dvd-rental-admin"
    },
    {
      "name": "customer-app",
      "path": "C:\\Users\\y_104\\git\\dvd-rental-customer-app"
    }
  ],
  "settings": {
    "java.import.maven.enabled": true
  }
}

Summary

ProblemWorkaround
Terminal gets absorbed by jshellRun commands via tasks.json tasks
Language Server uses old JDKExplicitly specify JDK in .vscode/settings.json
Copilot terminal execution flows into jshellExit jshell with :exit before requesting
Lombok red underlines won’t disappearnullAnalysis.mode: disabled
Project recognition issue in multi-rootExplicitly define with .code-workspace file

Java development in VS Code benefits from rich extensions,
but interference from multiple extensions touching the same resources is common.
When something “just doesn’t work,” checking the Language Server status and active terminals first is the fastest path to resolution.

Feel free to send a message

Please send a message if you have any technical questions, feedback, or inquiries.