[ 
https://issues.apache.org/jira/browse/MNG-5910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410134#comment-15410134
 ] 

Hervé Boutemy commented on MNG-5910:
------------------------------------

you used Severity.ERROR: I suppose using Severity.WARNING should do the job, 
even if I could not find any example

for the algorithm, avoid new Exception!

{code:java}        if ( StringUtils.isNotEmpty( file.getExists() ) )
        {
            path = file.getExists();
            missing = false;

            if ( StringUtils.isNotEmpty( file.getMissing() ) )
            {
                problems.add( new ModelProblemCollectorRequest( 
Severity.WARNING, Version.BASE )
                    .setMessage( "File activation for profile " + 
profile.getId() + ": missing " + file.getMissing() + " assertion ignored since 
exists assertion defined too, you should remove one" )
                    .setLocation( file.getLocation( "missing" ) ) );
            }
        }
        else if ( StringUtils.isNotEmpty( file.getMissing() ) )

{code}

> Using both {{exists}} and {{missing}} in the same {{file}} element should 
> lead to an exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: MNG-5910
>                 URL: https://issues.apache.org/jira/browse/MNG-5910
>             Project: Maven
>          Issue Type: Bug
>          Components: core, Profiles
>    Affects Versions: 3.3.3
>            Reporter: Konrad Windszus
>
> Currently it is not clear from the POM reference 
> (https://maven.apache.org/pom.html#Activation), that the elements {{exists}} 
> and {{missing}} below {{file}} are mutually exclusive, because only 
> {{exists}} is considered if it is there (see also 
> https://github.com/apache/maven/blob/master/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java#L91).
>  Please make it clearer in the POM reference that not both of them should be 
> used at the same time and also throw an exception during build time if that 
> is the case (in the effective POM).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to