redhat-developer / redhat-developer/vscode-java

Preventing .classpath overwrite

Open
#285 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,

While I'm fully aware that Android projects are unsupported, manually crafting .classpath files provide quite satisfying results - with the caveat that they don't support env vars, so you have to hardcode the path to your Android SDK.
For example, with a classpath that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
	<classpathentry kind="output" path="bin"/>
	<classpathentry kind="src" path="src/main/java"/>
	<classpathentry kind="lib" path="/Users/arnaud/dev/android-sdk/platforms/android-26/android.jar" />
</classpath>

I'm able, after indexing, to get completion for my project's classes, but also Android's.
Libraries need a little more work, but I don't mind doing everything manually, as both the platform version and libraries don't change often.

The problem is that vscode-java notices that this is a gradle project, and will overwrite.
I have to rewrite the .classpath with my version every time I reopen vscode.

I'd like to have a setting to tell the plugin never to overwrite .classpath on its own.

Environment
  • Operating System: macOS & Windows
  • JDK version: 1.8
  • Visual Studio Code version: 1.15.1
  • Java extension version: Latest as of writing
Steps To Reproduce
  1. Open a
  2. Patch the .classpath yourself. Make sure you back it up somewhere else
  3. Restart vscode
Current Result

.classpath was overwritten with an empty one

Expected Result

.classpath should have not been overwritten

Additional Informations

I tried setting " "java.configuration.updateBuildConfiguration": "disabled" ", but that does not help

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 restart workflow with a manually edited .classpath and the java.configuration.updateBuildConfiguration setting. Compare the file before and after reopening VS Code, then trace the extension's Gradle project handling. Done means a documented setting prevents automatic .classpath overwrites while normal project updates remain available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
build-system, devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.