[
https://issues.apache.org/jira/browse/MNG-6511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682596#comment-16682596
]
Falko Modler edited comment on MNG-6511 at 11/10/18 9:20 PM:
-------------------------------------------------------------
{quote}
In general that means strict is better to match the expected result.
{quote}
I'd still say that a user first and foremost just expects the given module not
to be built.
Anyhow, we have different opinons and it's of course up to you to decide
(otherwise).
{quote}
Since it seems you're already using scripts, maybe mavenrc is an option or the
Maven Project options introduced with MNG-5767 which seems to be porely
documented.
{quote}
You can't put {{-pl ! ...}} in {{.mvn/maven.config}} because it kicks in
regardless of which level you are operating on in your multi module project.
{{mvn}} will thus fail if you change the working directory or use {{-f}} in
such a way that one of the negated modules is not part of the reactor anymore.
I guess the same happens with mavenrc.
Anyway, I would _not_ put {{-pl ! ...}} in either of these files because that
would be like a permanent filter for the entire project causing those modules
never to be built.
Instead, I would put {{-pl ! ...}} into my "quick build" script (and maybe
other variants of that script) which lives happily next to my "pre push" script
which doesn't exclude anything (or just use {{mvn clean install}} or whatever).
For me the bottom line of this discussion is that the current behaviour won't
be changed, unfortunately.
I see one possible extension of {{-pl}}, though:
What if you could define something like {{-pl !?foo}}, meaning "exclude foo, if
exists"? And Wildcard or even Regex support would be even more flexible...
WDYT?
was (Author: famod):
{quote}
In general that means strict is better to match the expected result.
{quote}
I'd still say that a user first and foremost just expects the given module not
to be built.
Anyhow, we have different opinons and it's of course up to you to decide
(otherwise).
{quote}
Since it seems you're already using scripts, maybe mavenrc is an option or the
Maven Project options introduced with MNG-5767 which seems to be porely
documented.
{quote}
You can't put {{-pl ! ...}} in {{.mvn/maven.config}} because it kicks in
regardless of which level you are operating on in your multi module project.
{{mvn}} will thus fail if you change the working directory or use {{-f}} in
such a way that one of the negated modules is not part of the reactor anymore.
I guess the same happens with mavenrc.
Anyway, I would _not_ put {{-pl ! ...}} in either of these files because that
would be like a permanent filter for the entire project causing those modules
never to be built.
Instead, I would put {{-pl ! ...}} into my "quick build" script (and maybe
other variants of that script) which lives happily next to my "pre push" script
which doesn't exclude anything (or just use {{mvn clean install}} or whatever).
For me the bottom line of this discussion is that the current behaviour won't
be changed, unfortunalety.
I see one possible extension of {{-pl}}, though:
What if you could define something like {{-pl !?foo}}, meaning "exclude foo, if
exists"? And Wildcard or even Regex support would be even more flexible...
WDYT?
> Option -pl ! foo should not fail if foo does not exist
> ------------------------------------------------------
>
> Key: MNG-6511
> URL: https://issues.apache.org/jira/browse/MNG-6511
> Project: Maven
> Issue Type: Improvement
> Affects Versions: 3.3.9, 3.6.0
> Reporter: Falko Modler
> Priority: Major
>
> While I completely understand why Maven throws an error when
> {{\-pl/--projects}} defines/contains a non-existing project, I don't really
> see why the negation of a non-existing project yields the same error, e.g.:
> {noformat}
> c:\_dev\git\gitflow-incremental-builder>mvn -pl !foo
> [INFO] Scanning for projects...
> [ERROR] [ERROR] Could not find the selected project in the reactor: foo @
> [ERROR] Could not find the selected project in the reactor: foo -> [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
> {noformat}
> I'd say that at most this should be a warning, not an error.
> This change would come in handy to reuse scripts with certain default options
> (e.g. quickly build everything without tests, checkstyle, _exclude moduleX_,
> etc.) on different hierarchy levels of larger multi module project.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)