Skip to content

Commit c6d9a07

Browse files
trancexpressHannesWell
authored andcommitted
Add version constraints to junit-platform-launcher added in plug-in launch
1 parent 8d8b12d commit c6d9a07

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ui/org.eclipse.pde.unittest.junit/src/org/eclipse/pde/unittest/junit/launcher/JUnitPluginLaunchConfigurationDelegate.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.eclipse.jdt.core.IType;
6363
import org.eclipse.jdt.core.JavaCore;
6464
import org.eclipse.jdt.core.JavaModelException;
65+
import org.eclipse.jdt.internal.junit.buildpath.BuildPathSupport;
6566
import org.eclipse.jdt.internal.junit.launcher.ITestKind;
6667
import org.eclipse.jdt.internal.junit.launcher.JUnitLaunchConfigurationConstants;
6768
import org.eclipse.jdt.internal.junit.launcher.JUnitRuntimeClasspathEntry;
@@ -156,6 +157,7 @@ public String showCommandLine(ILaunchConfiguration configuration, String mode, I
156157
}
157158
}
158159

160+
@SuppressWarnings("restriction")
159161
private VMRunnerConfiguration getVMRunnerConfiguration(ILaunchConfiguration configuration, ILaunch launch,
160162
String mode, IProgressMonitor monitor) throws CoreException {
161163
VMRunnerConfiguration runConfig = null;
@@ -238,10 +240,10 @@ private VMRunnerConfiguration getVMRunnerConfiguration(ILaunchConfiguration conf
238240
if (!configuration.getAttribute(
239241
JUnitLaunchConfigurationConstants.ATTR_DONT_ADD_MISSING_JUNIT5_DEPENDENCY, false)) {
240242
if (!Arrays.stream(classpath).anyMatch(
241-
s -> s.contains("junit-platform-launcher") || s.contains("org.junit.platform.launcher"))) { //$NON-NLS-1$ //$NON-NLS-2$
243+
s -> s.contains(BuildPathSupport.JUNIT_PLATFORM_LAUNCHER) || s.contains("org.junit.platform.launcher"))) { //$NON-NLS-1$
242244
try {
243-
JUnitRuntimeClasspathEntry x = new JUnitRuntimeClasspathEntry("junit-platform-launcher", //$NON-NLS-1$
244-
null);
245+
JUnitRuntimeClasspathEntry x = new JUnitRuntimeClasspathEntry(BuildPathSupport.JUNIT_PLATFORM_LAUNCHER,
246+
null, BuildPathSupport.JUNIT_PLATFORM_VERSION);
245247
String entryString = new ClasspathLocalizer(Platform.inDevelopmentMode()).entryString(x);
246248
int length = classpath.length;
247249
System.arraycopy(classpath, 0, classpath = new String[length + 1], 0, length);

0 commit comments

Comments
 (0)