quarkusio/quarkus · error · MojoExecutionException

Could not access parent pom.

Error message

Could not access parent pom.

What it means

When reading the parent pom.xml during project creation, an IOException occurred (e.g. the file cannot be opened, parsed at the IO level, or permissions deny access). The mojo catches IOException from MojoUtils.readPom and rethrows it as this MojoExecutionException. It means the parent POM exists but was unreadable.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java:275

        }

        BuildTool buildToolEnum = BuildTool.findTool(buildTool);
        if (buildToolEnum == null) {
            String validBuildTools = String.join(",",
                    Arrays.asList(BuildTool.values()).stream().map(BuildTool::toString).collect(Collectors.toList()));
            throw new IllegalArgumentException("Choose a valid build tool. Accepted values are: " + validBuildTools);
        }
        if (BuildTool.MAVEN.equals(buildToolEnum)) {
            if (pom != null && pom.isFile()) {
                try {
                    parentPomModel = MojoUtils.readPom(pom);
                    if (!"pom".equals(parentPomModel.getPackaging())) {
                        throw new MojoExecutionException(
                                "The parent project must have a packaging type of POM. Current packaging: "
                                        + parentPomModel.getPackaging());
                    }
                } catch (IOException e) {
                    throw new MojoExecutionException("Could not access parent pom.", e);
                }
            } else if (containsAtLeastOneGradleFile) {
                throw new MojoExecutionException(
                        "You are trying to create a Maven project in a directory that contains only Gradle build files.");
            }
        } else if (BuildTool.GRADLE.equals(buildToolEnum) || BuildTool.GRADLE_KOTLIN_DSL.equals(buildToolEnum)) {
            if (containsAtLeastOneGradleFile) {
                throw new MojoExecutionException("Adding subprojects to gradle projects is not implemented.");
            } else if (pom != null && pom.isFile()) {
                throw new MojoExecutionException(
                        "You are trying to create gradle project in a directory that contains only maven build files.");
            }
        }

        askTheUserForMissingValues();
        if (!DEFAULT_ARTIFACT_ID.equals(projectArtifactId) && !OK_ID.matcher(projectArtifactId).matches()) {
            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, "artifactId", projectArtifactId));
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check file permissions on pom.xml (`ls -l pom.xml`) and fix with chmod
  2. Verify the pom is a regular readable file (not a broken symlink)
  3. Close other processes rewriting the pom and retry
  4. Run the goal from a directory with a normal accessible pom, or an empty directory

Example fix

// before
-rw------- pom.xml   # unreadable by current user
// after
chmod 644 pom.xml
Defensive patterns

Strategy: validation

Validate before calling

File pom = new File(dir, "pom.xml");
if (pom.isFile() && !pom.canRead()) throw new IllegalStateException("pom.xml is not readable: " + pom);

Try / catch

try {
    runCreateGoal();
} catch (MojoExecutionException e) {
    if (e.getMessage().equals("Could not access parent pom.")) {
        logCause(e.getCause()); // IOException details: permissions, symlink, fs error
    }
}

Prevention

When it happens

Trigger: Running `mvn quarkus:create` where a pom.xml exists in the directory but readPom throws IOException — unreadable file permissions, the file being replaced/deleted concurrently, or a filesystem error.

Common situations: pom.xml with restrictive permissions, read-protected network mounts, symlink to a missing target, or a race where the pom is being rewritten by another process.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/38f3b483b27f116e. Report an issue: GitHub.