redhat-developer / redhat-developer/vscode-java

Cannot build 1.8 maven project with system scope dependency

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

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

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

説明

To run the latest vscode-java extension, i installed JDK to java.home, and configured JDK 1.8 as the build JRE for 1.8 project. But it cannot build my 1.8 project any more because my maven project uses tools.jar as system scope dependency.

user settings:

    "java.home": "C:\\AdoptOpenJDK\\jdk-11.0.8.10-hotspot",
    "java.configuration.runtimes": [
        {
          "default": true,
          "name": "JavaSE-1.8",
          "path": "C:\\Java\\openjdk8u181-b13",
        }
    ]

pom.xml: (Since tools.jar is not required for JDK 9 and higher, i use a profile to filter whether to enable tools.jar dependency.)

<profiles>
    <profile>
        <id>default-tools.jar</id>
        <activation>
            <jdk>(,9)</jdk>
        </activation>
        <dependencies>
            <dependency>
                <groupId>com.sun</groupId>
                <artifactId>tools</artifactId>
                <version>1.8</version>
                <scope>system</scope>
                <systemPath>${java.home}/../lib/tools.jar</systemPath>
            </dependency>
        </dependencies>
    </profile>
</profiles>

The problem is when the extension imports pom.xml project, it uses the extension runtime (aka. Java 11) to resolve maven dependency, which will ignore tools.jar. But when building project, it uses the JDK 1.8 as the build JRE and fails to resolve tools.jar dependency. Currently i didn't find a good way to workaround this issue, unless update the compliance to 11.

This issue is already tracked in the upstream m2e Bug 432992 - java.home of the Eclipse JRE is used instead of the build JRE.

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

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

はじめの一歩

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

調査の方向性

Start with the reported java.home and java.configuration.runtimes settings and the pom.xml profile that declares tools.jar. Reproduce Maven project import and build with JDK 11 as the extension runtime and JDK 8 as the build JRE, then compare the behavior with upstream m2e Bug 432992. Done means the Java 8 project resolves tools.jar and builds without requiring compliance level 11.

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

評価

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

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

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