redhat-developer / redhat-developer/vscode-java
Cannot build 1.8 maven project with system scope dependency
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- build-system, developer-experience
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100