quarkusio/quarkus · error · QuarkusCommandException
Invalid directory structure, file not found: ${pom}
Error message
Invalid directory structure, file not found: ${pom} What it means
checkPomExists verifies dir/pom.xml exists and throws QuarkusCommandException('Invalid directory structure, file not found: <pom>') otherwise. It guards operations (readPom, BOM/IT-test/extension pom edits) that assume a Maven module layout.
Source
Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateExtensionCommandHandler.java:131
private void updateITParentPomAndMoveDir(String extensionDirName, Path newExtensionDir, Path itTestDir)
throws QuarkusCommandException, IOException {
final Path itTestPom = checkPomExists(itTestDir);
new PomTransformer(itTestPom, StandardCharsets.UTF_8)
.transform(PomTransformer.Transformation.addModule(extensionDirName));
FileUtils.moveDirectory(newExtensionDir.resolve("integration-tests").toFile(),
itTestDir.resolve(extensionDirName).toFile());
}
private void updateExtensionsParentPom(String extensionDirName, Path extensionsDir) throws QuarkusCommandException {
final Path extensionsPom = checkPomExists(extensionsDir);
new PomTransformer(extensionsPom, StandardCharsets.UTF_8)
.transform(PomTransformer.Transformation.addModule(extensionDirName));
}
public static Path checkPomExists(Path dir) throws QuarkusCommandException {
final Path pom = dir.resolve("pom.xml");
if (!Files.exists(pom)) {
throw new QuarkusCommandException("Invalid directory structure, file not found: " + pom.toString());
}
return pom;
}
public static Model readPom(Path dir) throws QuarkusCommandException {
final Path pom = checkPomExists(dir);
try {
return MojoUtils.readPom(pom.toFile());
} catch (IOException e) {
throw new QuarkusCommandException("Error while reading pom: " + pom.toString(), e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Run the command from the root of a multi-module Maven project that has a pom.xml
- Verify the --path and directory arguments point at existing Maven modules
- Add a pom.xml if the directory genuinely should be a Maven module
- Check current working directory is the intended project root
Example fix
// before mvn io.quarkus:quarkus-maven-plugin:create-extension -DextensionId=foo # run in ~/random-dir // after cd ~/quarkus # multi-module checkout with root pom.xml mvn io.quarkus:quarkus-maven-plugin:create-extension -DextensionId=foo
Defensive patterns
Strategy: validation
Validate before calling
Path pom = dir.resolve("pom.xml");
if (!Files.isRegularFile(pom)) throw new IllegalStateException("Not a Maven module (no pom.xml): " + dir); Type guard
static boolean isMavenModule(Path dir) {
return Files.isRegularFile(dir.resolve("pom.xml"));
} Try / catch
try { Path pom = CreateExtensionCommandHandler.checkPomExists(dir); } catch (QuarkusCommandException e) { /* prompt user to run from project root */ } Prevention
- Run create-extension from the root of a multi-module checkout
- Verify directory arguments before invoking
- Keep root pom.xml committed
- Avoid ad-hoc directories as targets
When it happens
Trigger: Running create-extension with a parent/bom/it-test/extensions directory that lacks a pom.xml — typically when the command is invoked from the wrong root or with wrong --path/group-id layout.
Common situations: Running 'quarkus create extension' outside a multi-module Quarkus checkout; typo in target directory; attempting to nest the extension in a folder without a Maven parent pom.
Related errors
- Unable to parse pom file: ${pom}
- Could not resolve POM for
- Unable to update the pom.xml file
- The parent project must have a packaging type of POM. Curren
- Unable to update the pom.xml file
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/97161933b81d9903.
Report an issue: GitHub.