{"id":"e090050786b39470","repo":"junit-team/junit5","slug":"outputdirectorycreator-not-available-probably-due","errorCode":null,"errorMessage":"OutputDirectoryCreator not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path.","messagePattern":"OutputDirectoryCreator not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path\\.","errorType":"exception","errorClass":"JUnitException","httpStatus":null,"severity":"error","filePath":"junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java","lineNumber":112,"sourceCode":"\t * @since 1.12\n\t * @deprecated Please use {@link #getOutputDirectoryCreator()} instead\n\t */\n\t@SuppressWarnings(\"removal\")\n\t@Deprecated(since = \"1.14\", forRemoval = true)\n\t@API(status = DEPRECATED, since = \"1.14\")\n\tdefault org.junit.platform.engine.reporting.OutputDirectoryProvider getOutputDirectoryProvider() {\n\t\treturn org.junit.platform.engine.reporting.OutputDirectoryProvider.castOrAdapt(getOutputDirectoryCreator());\n\t}\n\n\t/**\n\t * Get the {@link OutputDirectoryCreator} for this request.\n\t *\n\t * @return the output directory creator; never {@code null}\n\t * @since 1.14\n\t */\n\t@API(status = MAINTAINED, since = \"1.14\")\n\tdefault OutputDirectoryCreator getOutputDirectoryCreator() {\n\t\tthrow new JUnitException(\n\t\t\t\"OutputDirectoryCreator not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path.\");\n\t}\n\n}\n","sourceCodeStart":94,"sourceCodeEnd":117,"githubUrl":"https://github.com/junit-team/junit5/blob/956246301e03d757539f7b76dd5a91f298637563/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java#L94-L117","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before: build.gradle.kts with mismatched versions\nimplementation(\"org.junit.platform:junit-platform-engine:1.14\")\n// launcher missing or older\n\n// after: align via BOM\ndependencies {\n    implementation(platform(\"org.junit:junit-bom:6.x\"))\n    implementation(\"org.junit.platform:junit-platform-launcher\")\n    implementation(\"org.junit.platform:junit-platform-engine\")\n}","handlingStrategy":"validation","validationCode":"OutputDirectoryCreator creator;\ntry {\n    creator = request.getOutputDirectoryCreator();\n} catch (JUnitException e) {\n    throw new IllegalStateException(\"Launcher missing or versions unaligned; cannot get OutputDirectoryCreator\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return request.getOutputDirectoryCreator();\n} catch (JUnitException e) {\n    // degrade gracefully or surface a clear 'align your junit-platform-* versions' message\n    throw e;\n}","preventionTips":["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()."],"tags":["junit-platform","version-mismatch","launcher","classpath","module-path"],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}