quarkusio/quarkus · error · MojoExecutionException

Failed to parse removed resource '${entry.key}=${entry.resou

Error message

Failed to parse removed resource '${entry.key}=${entry.resources}'

What it means

In ExtensionDescriptorMojo.recordClassLoadingConfig, each removedResources entry's key is parsed with ArtifactKey.fromString. If the key string is not a valid artifact key (IllegalArgumentException), the mojo throws a MojoExecutionException quoting the offending key=resources pair, aborting descriptor generation.

Source

Thrown at independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java:443

        }

        if (runnerParentFirstArtifacts != null && !runnerParentFirstArtifacts.isEmpty()) {
            String val = String.join(COMMA, runnerParentFirstArtifacts);
            props.put(ApplicationModelBuilder.RUNNER_PARENT_FIRST_ARTIFACTS, val);
        }

        if (excludedArtifacts != null && !excludedArtifacts.isEmpty()) {
            String val = String.join(COMMA, excludedArtifacts);
            props.put(ApplicationModelBuilder.EXCLUDED_ARTIFACTS, val);
        }

        if (!removedResources.isEmpty()) {
            for (RemovedResources entry : removedResources) {
                final ArtifactKey key;
                try {
                    key = ArtifactKey.fromString(entry.key);
                } catch (IllegalArgumentException e) {
                    throw new MojoExecutionException(
                            "Failed to parse removed resource '" + entry.key + '=' + entry.resources + "'", e);
                }
                if (entry.resources == null || entry.resources.isBlank()) {
                    continue;
                }
                final String[] resources = entry.resources.split(COMMA);
                if (resources.length == 0) {
                    continue;
                }
                final String value;
                if (resources.length == 1) {
                    value = resources[0];
                } else {
                    final StringBuilder sb = new StringBuilder();
                    sb.append(resources[0]);
                    for (int i = 1; i < resources.length; ++i) {
                        final String resource = resources[i];
                        if (!resource.isBlank()) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the key in removedResources config to a valid groupId:artifactId form
  2. Use only the G:A of the artifact whose resources are being removed (no :jar/:type suffixes unless ArtifactKey accepts them)
  3. Check the cause in the stack trace for what ArtifactKey.fromString rejected

Example fix

<!-- before -->
<removedResources><key>quarkus-myext</key><resources>...</resources></removedResources>
<!-- after -->
<removedResources><key>io.quarkus:quarkus-myext</key><resources>...</resources></removedResources>
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check removedResources keys parse as ArtifactKeys
for (RemovedResources e : removedResources) {
  try { io.quarkus.maven.dependency.ArtifactKey.fromString(e.key); }
  catch (IllegalArgumentException ex) { throw new IllegalStateException("bad key: " + e.key, ex); }
}

Try / catch

try {
  invoker.executeMaven("extension-descriptor");
} catch (MojoExecutionException e) {
  if (e.getMessage().contains("Failed to parse removed resource")) { fixRemovedResourcesConfig(); }
  throw e;
}

Prevention

When it happens

Trigger: Configuring the removedResources parameter with a malformed artifact key, e.g. missing colon/group:artifact components or invalid characters — ArtifactKey.fromString rejects it.

Common situations: Typo like "myext" instead of "io.quarkus:quarkus-myext" in removedResources config; using paths or file names instead of artifact keys; copy-pasting config from a different context (artifact coords with type/classifier that ArtifactKey rejects).

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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