quarkusio/quarkus · error · MojoExecutionException
Could not create directory ${outputDirectory}
Error message
Could not create directory ${outputDirectory} What it means
In CreateProjectMojo.execute(), after the Maven version check, Files.createDirectories(outputDirectory.toPath()) is wrapped into a MojoExecutionException 'Could not create directory <path>'. It means the directory where the new Quarkus project would be generated could not be created on disk.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java:229
/**
* Whether to refresh the local extension catalog cache before searching for the recommended Quarkus extension versions
*/
@Parameter(property = "refresh", defaultValue = "false")
boolean refresh;
@Component
QuarkusWorkspaceProvider workspaceProvider;
@Override
public void execute() throws MojoExecutionException {
// We detect the Maven version during the project generation to indicate the user immediately that the installed
// version may not be supported.
mavenVersionEnforcer.ensureMavenVersion(getLog(), session);
try {
Files.createDirectories(outputDirectory.toPath());
} catch (IOException e) {
throw new MojoExecutionException("Could not create directory " + outputDirectory, e);
}
final MavenArtifactResolver mvn;
try {
mvn = MavenArtifactResolver.builder()
.setRepositorySystem(repoSystem)
.setRepositorySystemSession(
getLog().isDebugEnabled() ? repoSession : MojoUtils.muteTransferListener(repoSession))
.setRemoteRepositories(repos)
.setRemoteRepositoryManager(remoteRepoManager)
.build();
} catch (Exception e) {
throw new MojoExecutionException("Failed to initialize Maven artifact resolver", e);
}
final MojoMessageWriter log = new MojoMessageWriter(getLog());
ExtensionCatalogResolver catalogResolver = getExtensionCatalogResolver(mvn, log);
ExtensionCatalog catalog = resolveExtensionsCatalog(this, bomGroupId, bomArtifactId, bomVersion, stream,View on GitHub (pinned to e1c734241f)
Solutions
- Verify -DoutputDirectory points to a writable, non-existing-or-directory path and fix typos
- Remove any file occupying a segment of the target path
- Fix permissions/ownership of the target location or choose another directory
- Check free disk space and mount status (read-only volumes)
Example fix
// before mvn io.quarkus:quarkus-maven-plugin:create -DoutputDirectory=./pom.xml // path is a file // after mvn io.quarkus:quarkus-maven-plugin:create -DoutputDirectory=./my-app
Defensive patterns
Strategy: validation
Validate before calling
java.nio.file.Path out = java.nio.file.Path.of(outputDirectory).toAbsolutePath();
if (java.nio.file.Files.exists(out) && !java.nio.file.Files.isDirectory(out))
throw new IllegalStateException("outputDirectory is a file: " + out);
if (!java.nio.file.Files.isWritable(out.getParent() != null ? out.getParent() : out))
throw new IllegalStateException("Parent not writable: " + out); Try / catch
try {
mvn io.quarkus:quarkus-maven-plugin:create -DoutputDirectory=...
} catch (MojoExecutionException e) {
if (e.getMessage().startsWith("Could not create directory")) {
logger.error("Check path/permissions for {} before retrying", outputDirectory);
}
} Prevention
- Point outputDirectory at a new directory, never an existing file
- Confirm workspace write permissions (especially in CI containers)
- Check disk space and read-only mounts before project generation
When it happens
Trigger: Files.createDirectories(outputDirectory.toPath()) throws IOException — a file exists along the path, insufficient permissions, read-only mount, or invalid path characters.
Common situations: -DoutputDirectory typo (points at an existing file), generating into read-only CI workspace, permission-restricted shared folders, Windows path issues, disk full.
Related errors
- Unable to create directory: ${directory}
- Unable to collect the target directories
- Could not create directory ${outputDirectory}
- Failed to create <classesDir>
- Failed to create the output dir ${projectFile}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/cc294c09631d9780.
Report an issue: GitHub.