apache / apache/maven

[MNG-5001] @readonly Mojo parameter annotation doesn't work any more

Open
#7,147 11 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 40m
Merged PRs (30d)
275

Description

**[Jochen Ehret](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jochenehret)** opened **[MNG-5001](https://issues.apache.org/jira/browse/MNG-5001?redirect=false)** and commented

In Maven 2.2.1, the `@readonly` annotation works as described: You can't configure a Mojo parameter in the pom \ section. If you do, the build will fail:

```
[INFO] Error configuring: test:test-plugin. Reason: ERROR: Cannot override read-only parameter: testParameter in goal: test:dumpParameter
```

In Maven 3.0.2, the `@readonly` seems to have no effect:

```
[INFO] --- test-plugin:0.0.1-SNAPSHOT:dumpParameter (test-exec) @ test-project ---
testParameter: readonly parameter configured in pom
```

You can reproduce the behaviour with the attached example project. Log outputs for Maven 2.2.1 and 3.0.2 are also attached.

---

**Affects:** 3.0-alpha-1, 3.0.2

**Attachments:**
- [log-maven-2.2.1.txt](https://issues.apache.org/jira/secure/attachment/12713294/log-maven-2.2.1.txt) (_3.25 kB_)
- [log-maven-3.0.2.txt](https://issues.apache.org/jira/secure/attachment/12713296/log-maven-3.0.2.txt) (_5.28 kB_)
- [pom.xml](https://issues.apache.org/jira/secure/attachment/13000794/pom.xml) (_1.23 kB_)
- [readonlytest.zip](https://issues.apache.org/jira/secure/attachment/12713252/readonlytest.zip) (_3.48 kB_)

**Issue Links:**
- [MJAR-264](https://issues.apache.org/jira/browse/MJAR-264) finalName property can be set and is not immutable
(_**"fixes"**_)
- [MNG-5463](https://issues.apache.org/jira/browse/MNG-5463) warn if maven-site-plugin's reportPlugins is configured in POM
(_**"fixes"**_)
- [MNG-5440](https://issues.apache.org/jira/browse/MNG-5440) default-value on mojo parameter of type collection or array effectively make parameter read-only

- [MNG-5222](https://issues.apache.org/jira/browse/MNG-5222) Maven 3 no longer logs warnings about deprecated plugin parameters.

- [MNG-7464](https://issues.apache.org/jira/browse/MNG-7464) Warn about using read-only parameters for Mojo in configuration

- [MNG-5476](https://issues.apache.org/jira/browse/MNG-5476) [REGRESSION] `@required` parameter not being enforced for arrays

**Remote Links:**
- [GitHub Pull Request #240
](https://github.com/apache/maven/pull/240)

5 votes, 12 watchers

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.