quarkusio/quarkus · error · IllegalStateException
Artifact file not found for ${artifact}
Error message
Artifact file not found for ${artifact} What it means
DeploymentDependencyRuleSupport.parseDeploymentGAV reads a Quarkus runtime artifact's quarkus-extension.properties (EXT_PROPERTIES_PATH) to find its 'deployment-artifact' GAV. It first requires the artifact's local File to exist; if artifact.getFile() is null or the file does not exist on disk, it throws IllegalStateException 'Artifact file not found for <artifact>'.
Source
Thrown at independent-projects/enforcer-rules/src/main/java/io/quarkus/enforcer/DeploymentDependencyRuleSupport.java:96
execute(project, nonDeploymentArtifactsByGAV, directDepsByGAV);
}
protected abstract void execute(MavenProject project, Map<String, Artifact> nonDeploymentArtifactsByGAV,
Map<String, Dependency> directDepsByGAV)
throws EnforcerRuleException;
protected final String buildGAVKey(Artifact artifact) {
return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
}
protected final Optional<String> parseDeploymentGAV(String gav, Artifact artifact) {
return DEPLOYMENT_GAV_CACHE.computeIfAbsent(gav, k -> parseDeploymentGAV(artifact));
}
private Optional<String> parseDeploymentGAV(Artifact artifact) {
File artifactFile = artifact.getFile();
if (artifactFile == null || !artifactFile.exists()) {
throw new IllegalStateException("Artifact file not found for " + artifact);
}
Properties extProperties = new Properties();
if (artifactFile.isDirectory()) {
Path extPropertiesPath = artifactFile.toPath().resolve(EXT_PROPERTIES_PATH);
if (!Files.exists(extPropertiesPath)) {
return Optional.empty();
}
try (InputStreamReader isr = new InputStreamReader(Files.newInputStream(extPropertiesPath),
StandardCharsets.UTF_8)) {
extProperties.load(isr);
} catch (IOException e) {
throw new UncheckedIOException("Failed to read " + EXT_PROPERTIES_PATH + " from " + artifactFile, e);
}
} else {
try (ZipFile zipFile = new ZipFile(artifactFile)) {
ZipEntry entry = zipFile.getEntry(EXT_PROPERTIES_PATH);
if (entry == null) {View on GitHub (pinned to e1c734241f)
Solutions
- Ensure dependencies are resolved before enforcing: bind the rule to a phase after dependency resolution or call artifactResolver.resolveArtifact for the artifact first
- Verify the jar exists in the local repository (~/.m2/repository/...) and rebuild with network access
- Check scope configuration — the artifact must actually be part of the resolved dependency set
- For programmatic use, only pass artifacts whose getFile() is non-null and exists
Example fix
// before: inspecting an unresolved artifact rule.parseDeploymentGAV(unresolvedArtifact); // file == null // after: resolve first ArtifactResult res = repoSystem.resolveArtifact(session, new ArtifactRequest(artifact, repos, null)); rule.parseDeploymentGAV(artifact); // file now exists
Defensive patterns
Strategy: try-catch
Validate before calling
// Java: guard before inspecting
File f = artifact.getFile();
if (f == null || !f.exists()) {
throw new IllegalStateException("Resolve artifact before checking: " + artifact);
} Try / catch
try {
Optional<String> gav = support.getDeploymentGAV(artifact);
} catch (IllegalStateException | UncheckedIOException e) {
getLog().warn("Could not read extension metadata for " + artifact + "; resolve artifacts first", e);
} Prevention
- Bind the enforcer rule to a lifecycle phase after dependency resolution
- Never run builds with -o unless all artifacts are already cached
- Check scope configuration so needed artifacts are actually resolved
- In tests, resolve artifacts through the repository system rather than constructing bare Artifact instances
When it happens
Trigger: parseDeploymentGAV (via the cached wrapper called from BansRuntimeDependency / DeploymentDependencyRule) is given a Maven Artifact that has not been resolved — its file was never downloaded/copied into the local repository, e.g. an unresolved dependency or a provided-scope artifact with no backing file.
Common situations: Artifact resolved with scope that skips download; offline build where the jar was never fetched; a fake/partially-resolved Artifact object constructed programmatically in a test; corrupted local repository entry removed mid-build.
Related errors
- ${illegalRuntimeGAVs.size()} illegal runtime dependencies fo
- Failed to resolve reference artifact ${groupId}:${artifactId
- Failed to resolve artifact ${artifact}
- Failed to resolve
- Failed to resolve artifact ${artifact}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/443a2f05c3d0a5b9.
Report an issue: GitHub.