junit-team/junit5 · error · JUnitException
OutputDirectoryCreator not available; probably due to unalig
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
The default EngineDiscoveryRequest.getOutputDirectoryCreator() method (line 111-114) throws this JUnitException precisely to signal that no implementation supplied an OutputDirectoryCreator. In a normal Launcher setup the launcher overrides this default; hitting it means the junit-platform-launcher jar is absent or its version does not match junit-platform-engine, so the wiring that injects the creator never happens.
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 956246301e)
Solutions
- Align all junit-platform-* artifacts to the same version via the junit-bom in your dependency management.
- Ensure junit-platform-launcher is actually on the runtime classpath/module path, not just junit-platform-engine.
- If you implement EngineDiscoveryRequest yourself, override getOutputDirectoryCreator() to return a real OutputDirectoryCreator.
- Run a dependency tree (gradle dependencies / mvn dependency:tree) to confirm the launcher jar resolves and at the expected version.
Example fix
// before: build.gradle.kts with mismatched versions
implementation("org.junit.platform:junit-platform-engine:1.14")
// launcher missing or older
// after: align via BOM
dependencies {
implementation(platform("org.junit:junit-bom:6.x"))
implementation("org.junit.platform:junit-platform-launcher")
implementation("org.junit.platform:junit-platform-engine")
} Defensive patterns
Strategy: validation
Validate before calling
OutputDirectoryCreator creator;
try {
creator = request.getOutputDirectoryCreator();
} catch (JUnitException e) {
throw new IllegalStateException("Launcher missing or versions unaligned; cannot get OutputDirectoryCreator", e);
} Try / catch
try {
return request.getOutputDirectoryCreator();
} catch (JUnitException e) {
// degrade gracefully or surface a clear 'align your junit-platform-* versions' message
throw e;
} Prevention
- Use the junit-bom to keep all junit-platform-* artifacts at one version.
- Run a dependency tree check in CI to confirm junit-platform-launcher resolves.
- If you implement EngineDiscoveryRequest, always override getOutputDirectoryCreator().
When it happens
Trigger: A custom TestEngine or tool calls request.getOutputDirectoryCreator() on a hand-built EngineDiscoveryRequest that did not override the default method. Also triggered when junit-platform-engine is on the classpath but junit-platform-launcher is missing or is an older/newer version that predates the OutputDirectoryCreator API (added in 1.14).
Common situations: Mixing JUnit Platform versions (e.g. engine 1.14+ with launcher 1.13); shading/relocating jars and accidentally dropping the launcher; building a standalone tool that constructs EngineDiscoveryRequest implementations directly; module path setup where the launcher module is not resolved.
Related errors
- Could not find any resource(s) with name: ${this.classpathRe
- Launcher session has already been closed
- Cannot create Launcher for multiple engines with the same ID
- Invalid LauncherPhase '%s' set via the '%s' configuration pa
- Cannot override the standard style 'NONE'
AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04).
Data as JSON: /data/errors/e090050786b39470.json.
Report an issue: GitHub.