apache / apache/maven

[MNG-7052] Do not allow symbols as first character of identifiers in the POM

Open
#7,986 23 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Martin Kanters](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=martinkanters)** opened **[MNG-7052](https://issues.apache.org/jira/browse/MNG-7052?redirect=false)** and commented

In the `DefaultModelValidator` we currently validate identifiers against `a-zA-Z0-9-_.`
Since Maven also allows operators to be used against an identifier, this can result in bugs or at least unexpected behavior for the user.

The minus operator can be used to deactivate a certain profile, so an example would be:
- A project having a profile with the id `-id-of-profile`
- A Maven invocation of `mvn -P-id-of-profile`.

The release of Maven 4 is a nice opportunity to restrict the first character of an id to be `a-zA-Z0-9` . The other characters may still consist of those symbols.

This should apply to all identifiers that we support. The methods that need attention are:
`DefaultModelValidator#validateId` and `DefaultModelValidator#validateIdWithWildcards`.

---

**Issue Links:**
- [MNG-7051](https://issues.apache.org/jira/browse/MNG-7051) Optionally skip non-existing profiles
(_**"is caused by"**_)
- [MNG-7051](https://issues.apache.org/jira/browse/MNG-7051) Optionally skip non-existing profiles

- [MNG-7107](https://issues.apache.org/jira/browse/MNG-7107) Relax recently introduced profile id validation

- [MNG-6862](https://issues.apache.org/jira/browse/MNG-6862) Wrong command line analysis for joined profile activation
(_**"is depended upon by"**_)

1 votes, 7 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.