Skip to content

Maven/Nexus deploy fails or leaves unresolved property variables in POM #11699

@ravikk9

Description

@ravikk9

Affected version

Apache Maven 3.9.12 (3.9.x)

Bug description

Maven/Nexus Variable Substitution Bug

Issue Summary

When deploying a Maven project (POM only packaging) to Nexus, the deployment fails if the pom.xml contains three or more ${} variable references (even in comments). If there are two or fewer, the deploy succeeds, but the variables are not resolved in the uploaded .pom file. This breaks standard Maven property usage and prevents correct artifact publishing.

Troubleshooting and Observations

  • Tested with minimal and realistic POMs.
  • Behavior:
    • 3+ ${}: Deploy fails, .pom is not uploaded.
    • 2 or fewer ${}: Deploy succeeds, but variables remain unresolved in the uploaded .pom.
  • Tested with both property variables and hardcoded values.
  • Changing the Nexus layout policy to Permissive did not resolve the variable substitution issue.

Example POMs

Fails to Deploy (3 ${} references)

<project>
  ...
  <!-- ${} -->
  <!-- ${} -->
  <!-- ${} -->
  ...
</project>

Deploys, but Variables Not Resolved (2 ${} references)

<project>
  ...
  <!-- ${} -->
  <!-- ${} -->
  ...
</project>

Realistic Example from pom-wip.xml

<properties>
  <fmt-maven-plugin.version>2.13</fmt-maven-plugin.version>
  <formatter-maven-plugin.version>2.27.0</formatter-maven-plugin.version>
</properties>
<build>
  <plugins>
    <plugin>
      <groupId>com.coveo</groupId>
      <artifactId>fmt-maven-plugin</artifactId>
      <version>${fmt-maven-plugin.version}</version>
    </plugin>
    <plugin>
      <groupId>net.revelc.code.formatter</groupId>
      <artifactId>formatter-maven-plugin</artifactId>
      <version>${formatter-maven-plugin.version}</version>
    </plugin>
  </plugins>
</build>

Nexus Audit Log Snippets

Failed Upload (with property variables)

{"timestamp":"2026-01-28 14:11:18,346+0000", ... "kind":"" ...}
... (no kind "pom" or packaging "pom" in logs)

Successful Upload (with hardcoded versions)

{"timestamp":"2026-01-28 14:52:03,493+0000", ... "kind":"pom" ...}
{"timestamp":"2026-01-28 14:52:03,552+0000", ... "kind":"ARTIFACT" ...}
... (packaging "pom" and kind "pom" present in logs)

Impact

  • Standard Maven property usage is broken.
  • Variable substitution does not work as expected.
  • Artifacts may not be published or may be published with unresolved variables.

Steps to Reproduce

  1. Create a minimal POM with 3+ ${} references (even in comments).
  2. Run mvn deploy to Nexus.
  3. Observe that the .pom file is not uploaded.
  4. Reduce to 2 or fewer ${} and deploy again; upload succeeds but variables are not resolved.

Environment

  • Maven 3.9.x
  • Nexus Repository Manager 3.x

Request

  • Please investigate and advise on a fix or workaround.
  • Is this a known issue? Are there patches or configuration changes that can resolve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions