redhat-developer / redhat-developer/vscode-java
Cannot build 1.8 maven project with system scope dependency
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.3k
- Forks
- 547
- Merge medio
- 20 h 1 min
- PR fusionados (30 d)
- 11
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- build-system, developer-experience
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100