Skip to content

Commit 6e71772

Browse files
committed
VMs is toolchains are not detected
A wrong/too early guard was preventing from actually processing the VM installation. Also explicit a test transitively requires Java 1.8 to run
1 parent d31ccee commit 6e71772

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

org.eclipse.m2e.jdt.tests/projects/basicProjectWithDep/pom.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
<groupId>ewq</groupId>
44
<artifactId>bugM2e2</artifactId>
55
<version>0.0.1-SNAPSHOT</version>
6-
7-
<dependencies>
8-
<dependency>
9-
<groupId>org.apache.logging.log4j</groupId>
10-
<artifactId>log4j-core</artifactId>
11-
<version>2.17.1</version>
12-
</dependency>
13-
</dependencies>
6+
7+
<properties>
8+
<maven.compiler.source>1.8</maven.compiler.source>
9+
<maven.compiler.target>1.8</maven.compiler.target>
10+
</properties>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>org.apache.logging.log4j</groupId>
15+
<artifactId>log4j-core</artifactId>
16+
<version>2.17.1</version>
17+
</dependency>
18+
</dependencies>
1419
</project>

org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/LookupJDKToolchainsJob.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,16 @@ private void addToolchain(ToolchainModel toolchain) {
8282
.noneMatch(install -> isSameCanonicalFile(candidate, install))) {
8383
VMStandin workingCopy = new VMStandin(standardType, candidate.getAbsolutePath());
8484
workingCopy.setInstallLocation(candidate);
85-
if (workingCopy.getJavaVersion() != null) {
86-
String name = candidate.getName();
87-
int i = 1;
88-
while (isDuplicateName(name)) {
89-
name = candidate.getName() + '(' + i++ + ')';
90-
}
91-
workingCopy.setName(name);
92-
IVMInstall newVM = workingCopy.convertToRealVM();
93-
// next lines workaround https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/248
94-
if (!(newVM instanceof IVMInstall2 newVM2 && newVM2.getJavaVersion() != null)) {
95-
standardType.disposeVMInstall(newVM.getId());
96-
}
85+
String name = candidate.getName();
86+
int i = 1;
87+
while (isDuplicateName(name)) {
88+
name = candidate.getName() + '(' + i++ + ')';
89+
}
90+
workingCopy.setName(name);
91+
IVMInstall newVM = workingCopy.convertToRealVM();
92+
// next lines workaround https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/248
93+
if (!(newVM instanceof IVMInstall2 newVM2 && newVM2.getJavaVersion() != null)) {
94+
standardType.disposeVMInstall(newVM.getId());
9795
}
9896
}
9997
});

0 commit comments

Comments
 (0)