redhat-developer / redhat-developer/vscode-java

vscode generates compile errors for valid test-jar dependencies

オープン
#4,146 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、両方の Maven プロジェクトを読み込んだ状態で VS Code で test-jar-issue-projects.zip を開き、その後、利用側のプロジェクトのみを含む workspace と診断結果を比較します。プロジェクトが有効であることを確認するために mvn clean install を実行します。両方のプロジェクトが存在する場合に、ローカルの test-jar インポートで偽のコンパイルエラーが発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。