ravikk9 opened a new issue, #11699:
URL: https://github.com/apache/maven/issues/11699
### 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)
```xml
<project>
...
<!-- ${} -->
<!-- ${} -->
<!-- ${} -->
...
</project>
```
### Deploys, but Variables Not Resolved (2 `${}` references)
```xml
<project>
...
<!-- ${} -->
<!-- ${} -->
...
</project>
```
### Realistic Example from pom-wip.xml
```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?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]