quarkusio/quarkus · error · IllegalStateException

Failed to locate among the project dependencies

Error message

Failed to locate ${appArtifactCoords} among the project dependencies

What it means

When the appArtifact coordinate has no explicit version, the Quarkus Maven plugin tries to infer the version by scanning the project's dependencies for a dependency matching the given groupId, artifactId, classifier and type. This IllegalStateException is thrown when no such dependency exists in the project's resolved dependency list.

Solutions

  1. Append an explicit version to the appArtifact coordinate, e.g. com.acme:my-app:1.0.0
  2. Or add the artifact (with matching groupId:artifactId) as a dependency in the project pom.xml
  3. Verify groupId/artifactId spelling matches the project dependency exactly, including classifier and type

Example fix

// before
<appArtifact>com.acme:my-app</appArtifact>
// after
<appArtifact>com.acme:my-app:1.0.0</appArtifact>
Defensive patterns

Strategy: validation

Validate before calling

// ensure version is present or the artifact is a project dependency
String[] parts = appArtifactCoords.split(":");
boolean hasVersion = parts.length == 5;
boolean isDependency = project.getDependencies().stream()
    .anyMatch(d -> d.getGroupId().equals(parts[0]) && d.getArtifactId().equals(parts[1]));
if (!hasVersion && !isDependency) {
    throw new IllegalStateException(
        "appArtifact " + appArtifactCoords + " has no version and is not a project dependency");
}

Try / catch

try {
    mojo.appArtifact(coords);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("Failed to locate")) {
        // add explicit version to coordinates or add the dependency to the pom
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling appArtifact with a coordinate lacking a version (e.g. 'com.acme:my-app') while no dependency with matching groupId/artifactId/classifier/type is present in the project's dependencies.

Common situations: Omitting the version segment from appArtifact while the artifact is not a project dependency; typo in groupId or artifactId so it doesn't match any dependency; the dependency was removed or renamed after a version upgrade; wrong classifier/type specified.

Related errors


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

Appendix: source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java:563

            } else if (coordsArr.length > 3) {
                classifier = coordsArr[2] == null ? ArtifactCoords.DEFAULT_CLASSIFIER : coordsArr[2];
                type = coordsArr[3] == null ? ArtifactCoords.TYPE_JAR : coordsArr[3];
                if (coordsArr.length > 4) {
                    version = coordsArr[4];
                }
            }
            if (version == null) {
                for (Artifact dep : mojo.mavenProject().getArtifacts()) {
                    if (dep.getArtifactId().equals(artifactId)
                            && dep.getGroupId().equals(groupId)
                            && dep.getClassifier().equals(classifier)
                            && dep.getType().equals(type)) {
                        version = dep.getVersion();
                        break;
                    }
                }
                if (version == null) {
                    throw new IllegalStateException(
                            "Failed to locate " + appArtifactCoords + " among the project dependencies");
                }
            }

            return ResolvedDependencyBuilder.newInstance()
                    .setGroupId(groupId)
                    .setArtifactId(artifactId)
                    .setClassifier(classifier)
                    .setType(type)
                    .setVersion(version);
        }

        @Override
        public void close() {
            if (prodApp != null) {
                prodApp.close();
                prodApp = null;
            }

View on GitHub (pinned to e1c734241f)