[ 
https://issues.apache.org/jira/browse/MENFORCER-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylwester Lachiewicz updated MENFORCER-395:
-------------------------------------------
    Fix Version/s: 3.0.1

> NPE on requireReleaseDeps with non-matching includes
> ----------------------------------------------------
>
>                 Key: MENFORCER-395
>                 URL: https://issues.apache.org/jira/browse/MENFORCER-395
>             Project: Maven Enforcer Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>         Environment: maven-enforcer-plugin version: 3.0.0
> Maven versions: 3.3.9, 3.8.1
> Java 1.8.0_221
>            Reporter: Jonathon Merz
>            Assignee: Sylwester Lachiewicz
>            Priority: Major
>             Fix For: 3.0.1
>
>         Attachments: pom.enforcer-npe.xml, stacktrace.txt
>
>
> h2. Overview
> When a requireReleaseDeps rule is configured with an <include> pattern that 
> does not match any artifacts in the module, it results in a 
> NullPointerException. Stacktrace attached in [^stacktrace.txt].
> h2. Minimal test case
> To reproduce, use attached [^pom.enforcer-npe.xml] and run:
> {code:sh}
> mvn -f pom.enforcer-npe.xml -X validate
> {code}
> *Actual Results:* The build fails with NullPointerException
> *Expected Results:* The build succeeds because there is no SNAPSHOT version 
> of a matching artifact that violates the requireReleaseDeps rule.
> h2. Workarounds:
> If the <include> entry matches no artifacts because there is no such 
> dependency in the project, the workaround is simple: remove the unnecessary 
> <includes>. (This is the scenario presented in the minimal test case above.)
> Another scenario is that the maven-enforcer-plugin configuration is in the 
> parent module of a multi-module project where some child modules have a 
> dependency on 'testgroup:testartifact' and others do not. The parent module 
> is configured to disallow SNAPSHOT versions of that artifact. If the parent 
> module or one of the child modules do not have that dependency, then the 
> <include> fails to match during validation and the NPE happens. This is more 
> complicated to work around - the configuration must be copied to each module 
> and adjusted based on each individual module's dependencies.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to