redhat-developer / redhat-developer/vscode-java

Visual Studio Code deleting class files in target folder

Open
#2,909 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm working on multi module Maven project, i built in cmd using mvn clean install/deploy and the build is successful, all the class files in target\class folder are generated.

But when i import this project in VS Code, while opening the projects it is deleting all the class files i.e it deletes target\classes*com* folder in all the projects.

And, VS code doesn't resolve the dependencies in java files until the file is opened.

How do I fix this?

So, when the all the class files are deleted, it is unable to debug the code. While I try to run the code, it shows following error:

Error: Could not find or load main class com.application.Main Caused by: java.lang.ClassNotFoundException: com.application.Main

Environment
  • Operating System: Windows 10
  • JDK version: 11+
  • Visual Studio Code version: 1.74.3

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 by reproducing the issue with the reported multi-module Maven project on Windows 10 using JDK 11+ and VS Code 1.74.3. Inspect the target\classes output while the project opens, then verify whether dependency resolution and debugging recover without the generated com files being deleted. Done means identifying the cause and documenting or implementing a fix for the class-file deletion and resulting ClassNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.