Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

vscode generates compile errors for valid test-jar dependencies

Offen
#4,146 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
java
Bereich
devtools

Rechercherichtung

Öffne zunächst test-jar-issue-projects.zip in VS Code, wobei beide Maven-Projekte geladen sind, und vergleiche dann die Diagnosen mit einem Workspace, der nur das konsumierende Projekt enthält. Führe mvn clean install aus, um zu bestätigen, dass die Projekte gültig sind; die Aufgabe ist abgeschlossen, wenn lokale test-jar-Importe bei vorhandenen beiden Projekten keine falschen Kompilierungsfehler mehr erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

I have a non shipping "utility" maven module. It has a dependency on classes from a test-jar produced by another module. If both the utility maven module and the test-jar producing module are loaded in the workspace, vscode generates compile errors for all imported test-jar classes. See the first screenshot below. Note that the compile errors in vscode are incorrect and should not exist. In contrast, running "mvn clean install" results in a successful build and IntelliJ handles this situation fine (there are no compile errors).

If however the module that produces the test jar is not loaded in the workspace, there are no compile errors for the imported test-jar classes in vscode. See the second screenshot below. In otherwords, the compile error only shows up when the test-jar producing module is in the workspace with the test-jar consuming module. Apparently vscode/eclipse jdt cannot resolve the test classes when they are from a local project and imported by another project's src/main classes.

I will attach 2 small maven projects to demonstrate the problem. You can load them into vscode to reproduce. You can also build them from the command line with mvn to confirm they are valid.

Compile error when both test-jar consuming and producing projects are in the workspace
Image

No compile error when the test-jar producing project is not in the workspace
Image

test-jar-issue-projects.zip

Vorherrschende Sprache
TypeScript
Sterne
2.3k
Forks
547
Ø Merge
5 Std. 36 Min.
Gemergte PRs (30 T.)
10

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus redhat-developer/vscode-java

Alle Issues in redhat-developer/vscode-java

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.