Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

vscode generates compile errors for valid test-jar dependencies

未關閉
#4,146 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 4 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
java
領域
devtools

研究方向

先在 VS Code 中開啟 test-jar-issue-projects.zip,並載入兩個 Maven 專案,然後將診斷結果與只包含使用端專案的 workspace 進行比較。執行 mvn clean install 以確認專案有效;當兩個專案都存在時,本機 test-jar 匯入不再產生錯誤的編譯錯誤,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
TypeScript
星號
2.3k
分支
547
平均合併
5 小時 36 分鐘
30 天內合併 PR
10

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

redhat-developer/vscode-java 的其他 Issue

查看 redhat-developer/vscode-java 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。