apache / apache/maven

[MNG-7183] Plugin declaration silently ignored if groupId uses property references

Open
#8,271 2 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Martin D'Aloia](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mdaloia)** opened **[MNG-7183](https://issues.apache.org/jira/browse/MNG-7183?redirect=false)** and commented

Declaring a plugin where its `` value is/contains a property reference (`${example`}) is silently ignored and no error is thrown since Maven 3.6.2 (worked on 3.6.1).

**Actual behavior:**
- Plugin configuration silently ignored

**Expected behavior:**
- Work as in 3.6.1, or
- Produce an error if such config is not allowed

**Workaround:**
* Use a static value for the \ without property references

**Suspecting root cause:**
* MNG-6697

Attached you could find a self-contained example using the `maven-clean-plugin` (but also happens with third-party plugins).
To ease the comparison, this has 2 profiles: one declares the value explicitly and the other (indirect) via a property reference.

Execute it as: `./run.sh`
and you will get at the end:

```
./out/maven-3.8.1-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
./out/maven-3.8.1-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.8.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.8.1-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.3-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.3-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.6.3-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.3-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.2-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.2-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.6.2-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.2-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.1-profile-indirect.log:[DEBUG] (f) skip = true
./out/maven-3.6.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.1-profile-explicit.log:[DEBUG] (f) skip = true
```

Here you could see that the plugin version (2.5) and skip (false) configuration isn't what was configured for `indirect` profile.

Another example, defining a base config as ``, it is also ignoring the specific `` on `` usage.

Execute it as: `./run.sh pom-pluginManagement.xml`
and you will get at the end:

```
./out/maven-3.8.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.8.1-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.8.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.8.1-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.3-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.3-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.6.3-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.3-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.2-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.2-profile-indirect.log:[DEBUG] (f) skip = false
./out/maven-3.6.2-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.2-profile-explicit.log:[DEBUG] (f) skip = true
./out/maven-3.6.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.1-profile-indirect.log:[DEBUG] (f) skip = true
./out/maven-3.6.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
./out/maven-3.6.1-profile-explicit.log:[DEBUG] (f) skip = true
```

 

---

**Affects:** 3.6.2, 3.6.3, 3.8.1

**Attachments:**
- [bug-example.zip](https://issues.apache.org/jira/secure/attachment/13030376/bug-example.zip) (_2.56 kB_)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.