[MNG-7033] Excluded projects through -pl should not need to be in the reactor
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 21h 11m
- Merged PRs (30d)
- 312
Description
**[Adam Gent](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=agentgt)** opened **[MNG-7033](https://issues.apache.org/jira/browse/MNG-7033?redirect=false)** and commented
TLDR if you exclude a module using `!module` or `-module` with `-pl` that module needs to somehow be in the resolved reactor.
We have custom build scripts (e.g. shells scripts or makes) that will make a certain subset of the project using `-pl`. However some modules we want to always exclude. (Yes we could use profiles but the maintenance of that solution is unacceptable to us).
Thus if we do something like this:
```sh
mvn install -pl "snaphop-cache,-snaphop-http" -amd
```
We may or not may not get the following depending on whether snaphop-cache has a downstream dependency on snaphop-http:
```
[INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: snaphop-http @
[ERROR] Could not find the selected project in the reactor: snaphop-http -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
```
Thus it becomes nontrivial to exclude a module. One has to know whether or not `snaphop-cache` will trigger `snaphop-http` to be in the reactor.
Furthermore the command may fail if some one changes dependencies (not project structure or modules).
I find that to be alarming. `-pl` shouldn't fail if dependencies change.
Its notable that the following is completely fine:
```sh
mvn install -pl "snaphop-cache,snaphop-http" -amd
```
Which is confusing and inconsistent that one can't then add `-`.
My recommendation is if -pl can't find the exclusion module in the currently selected reactor is just ignores it or perhaps issues a warning.
---
**Affects:** 3.6.0, 3.6.1, 3.6.3
**Issue Links:**
- [MNG-6511](https://issues.apache.org/jira/browse/MNG-6511) Option -pl ! foo should not fail if foo does not exist
(_**"duplicates"**_)
- [MNG-5230](https://issues.apache.org/jira/browse/MNG-5230) Command line option to exclude modules from reactor
1 votes, 7 watchers
Contributor guide
Research direction
Start by reproducing the documented `mvn install -pl "snaphop-cache,-snaphop-http" -amd` command and compare it with the positively selected form. Trace Maven's `-pl` project-selection handling, including the linked duplicate MNG-6511. Done means an excluded project absent from the resolved reactor no longer causes selection to fail, or produces the agreed warning behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100