junit-team/junit5 · critical · JUnitException

OutputDirectoryCreator not available; probably due to…

Error message

OutputDirectoryCreator not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path.

What it means

EngineDiscoveryRequest.getOutputDirectoryCreator() is a default method that throws unless the concrete implementation overrides it (the Launcher's request implementation does). The message indicates the engine jar on the runtime classpath/module path is newer than the launcher jar, so the launcher never supplied an overriding implementation. This is a version-alignment defect surfaced at discovery time.

Solutions

  1. Align junit-platform-engine and junit-platform-launcher (and junit-platform-console) to the exact same version; use the junit-bom to keep them consistent.
  2. Run 'gradle dependencies' / 'mvn dependency:tree' and look for different patch/minor versions of platform-engine vs platform-launcher.
  3. If using the standalone console launcher, use the matching standalone jar version and do not add separate engine jars to the classpath.
  4. After aligning, clean and rebuild to flush stale resolved versions.

Example fix

// before (gradle) — mismatched
implementation 'org.junit.platform:junit-platform-engine:1.14.0'
implementation 'org.junit.platform:junit-platform-launcher:1.10.0'
// after — align via BOM
implementation platform('org.junit.platform:junit-platform-bom:1.14.0')
implementation 'org.junit.platform:junit-platform-engine'
implementation 'org.junit.platform:junit-platform-launcher'
Defensive patterns

Strategy: validation

Validate before calling

// At startup, verify engine and launcher versions match.
// Simplest: resolve via the junit-bom and assert in tests:
String engine = org.junit.platform.engine.EngineDiscoveryRequest.class.getPackage().getImplementationVersion();
String launcher = org.junit.platform.launcher.Launcher.class.getPackage().getImplementationVersion();
if (engine != null && launcher != null && !engine.equals(launcher))
  throw new IllegalStateException("platform-engine " + engine + " != platform-launcher " + launcher);

Prevention

When it happens

Trigger: Mixing an older junit-platform-launcher jar with a newer junit-platform-engine jar (>=1.14) such that code calling getOutputDirectoryCreator() reaches the default throwing method. The launcher's internal EngineDiscoveryRequest implementation overrides this method; an older launcher lacks the override.

Common situations: Pulling in junit-platform-engine 1.14+ transitively while a build tool pins junit-platform-launcher to an older version; using junit-platform-console-standalone of one version plus explicit engine deps of another; misaligned BOM usage; IDE/Gradle dependency resolution resolving the engine and launcher to different versions.

Related errors


AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11). Data as JSON: /api/errors/e090050786b39470. Report an issue: GitHub.

Appendix: source

Thrown at junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java:112

	 * @since 1.12
	 * @deprecated Please use {@link #getOutputDirectoryCreator()} instead
	 */
	@SuppressWarnings("removal")
	@Deprecated(since = "1.14", forRemoval = true)
	@API(status = DEPRECATED, since = "1.14")
	default org.junit.platform.engine.reporting.OutputDirectoryProvider getOutputDirectoryProvider() {
		return org.junit.platform.engine.reporting.OutputDirectoryProvider.castOrAdapt(getOutputDirectoryCreator());
	}

	/**
	 * Get the {@link OutputDirectoryCreator} for this request.
	 *
	 * @return the output directory creator; never {@code null}
	 * @since 1.14
	 */
	@API(status = MAINTAINED, since = "1.14")
	default OutputDirectoryCreator getOutputDirectoryCreator() {
		throw new JUnitException(
			"OutputDirectoryCreator not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path.");
	}

}

View on GitHub (pinned to f070c699a0)