You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christian Schulte <sc...@apache.org> on 2016/01/28 17:49:38 UTC

Re: [jira] [Reopened] (MNG-5227) The 'optional' flag of a dependency should be manageable.

Can someone please take a look at this? MNG-5227 is already checked in 
(with IT) and I would not want to revert it. It is triggering a bug in 
Aether I just reported and provided a patch for. How to procceed?


Am 01/28/16 um 17:37 schrieb Christian Schulte (JIRA):
>
>       [ https://issues.apache.org/jira/browse/MNG-5227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Christian Schulte reopened MNG-5227:
> ------------------------------------
>
> This issue is blocked by [Aether Bug 486740|https://bugs.eclipse.org/bugs/show_bug.cgi?id=486740].
>
>> The 'optional' flag of a dependency should be manageable.
>> ---------------------------------------------------------
>>
>>                  Key: MNG-5227
>>                  URL: https://issues.apache.org/jira/browse/MNG-5227
>>              Project: Maven
>>           Issue Type: Bug
>>           Components: Artifacts and Repositories
>>     Affects Versions: 3.0.3
>>             Reporter: Christian Schulte
>>             Assignee: Christian Schulte
>>             Priority: Minor
>>              Fix For: 3.4.0
>>
>>
>> {code}
>> <dependencyManagement>
>>    <dependencies>
>>      <dependency>
>>        <groupId>groupId</groupId>
>>        <artifactId>artifactId</artifactId>
>>        <version>version</version>
>>        <optional>false</optional> <!-- Ignored by Maven 2 & 3 in dependency management. -->
>>      </dependency>
>>    </dependencies>
>> </dependencyManagement>
>> {code}
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [jira] [Reopened] (MNG-5227) The 'optional' flag of a dependency should be manageable.

Posted by Jason van Zyl <ja...@takari.io>.
I believe what Christian is asserting is that if you so choose to manage the optional flag because that’s how you use a particular dependency within your multi-module application build that it should be retained. It may very well be that a set of modules need an optional dependency to compile but it truly is up to the user of your output to bring that dependency back in if they wish. To prevent it from losing the optional flag and ending up in the packaging within your own build is what this is trying to fix.

I agree with Christian from the perspective that if a user sets the parameter to be optional that it should not magically disappear on them in use in a child module. It’s not up to us how someone wants to manage their dependencies and I would expect by the principle of least surprise in this case the optional flag should not get stripped if a user sets it.

> On Jan 29, 2016, at 5:50 AM, Robert Scholte <rf...@apache.org> wrote:
> 
> Hi,
> What interested me is that is seems to be the intention to NOT manage the optional flag.[1]
> Why would you set the optional flag when using dependency management?
> 
> this just means, that if you want to use this dependency, you explicitly need to set the optional to false? That doesn't feel right.
> Instead I would expect that in case of dependencyManagement you cannot set the optional-tag.
> 
> Or am I missing something?
> 
> thanks,
> Robert
> 
> [1] https://issues.apache.org/jira/browse/MNG-4600
> 
> 
> Op Thu, 28 Jan 2016 17:49:38 +0100 schreef Christian Schulte <sc...@apache.org>:
> 
>> Can someone please take a look at this? MNG-5227 is already checked in (with IT) and I would not want to revert it. It is triggering a bug in Aether I just reported and provided a patch for. How to procceed?
>> 
>> 
>> Am 01/28/16 um 17:37 schrieb Christian Schulte (JIRA):
>>> 
>>>      [ https://issues.apache.org/jira/browse/MNG-5227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>>> 
>>> Christian Schulte reopened MNG-5227:
>>> ------------------------------------
>>> 
>>> This issue is blocked by [Aether Bug 486740|https://bugs.eclipse.org/bugs/show_bug.cgi?id=486740].
>>> 
>>>> The 'optional' flag of a dependency should be manageable.
>>>> ---------------------------------------------------------
>>>> 
>>>>                 Key: MNG-5227
>>>>                 URL: https://issues.apache.org/jira/browse/MNG-5227
>>>>             Project: Maven
>>>>          Issue Type: Bug
>>>>          Components: Artifacts and Repositories
>>>>    Affects Versions: 3.0.3
>>>>            Reporter: Christian Schulte
>>>>            Assignee: Christian Schulte
>>>>            Priority: Minor
>>>>             Fix For: 3.4.0
>>>> 
>>>> 
>>>> {code}
>>>> <dependencyManagement>
>>>>   <dependencies>
>>>>     <dependency>
>>>>       <groupId>groupId</groupId>
>>>>       <artifactId>artifactId</artifactId>
>>>>       <version>version</version>
>>>>       <optional>false</optional> <!-- Ignored by Maven 2 & 3 in dependency management. -->
>>>>     </dependency>
>>>>   </dependencies>
>>>> </dependencyManagement>
>>>> {code}
>>> 
>>> 
>>> 
>>> --
>>> This message was sent by Atlassian JIRA
>>> (v6.3.4#6332)
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder, Takari and Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [jira] [Reopened] (MNG-5227) The 'optional' flag of a dependency should be manageable.

Posted by Christian Schulte <cs...@schulte.it>.
MNG-5959 - Different wording, same use case.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [jira] [Reopened] (MNG-5227) The 'optional' flag of a dependency should be manageable.

Posted by Christian Schulte <cs...@schulte.it>.
Am 01/29/16 um 11:50 schrieb Robert Scholte:
> Hi,
> What interested me is that is seems to be the intention to NOT manage the
> optional flag.[1]

It's one of those issues flagged a regression in Maven 3 which hasn't 
been. Maven 2 just did not have support for it. It got removed for Maven 
3.0 in 2010 and added to Aether in 2013 without (re-)adding it to Maven 
(Aether Bugs 399822 398572 - there are others, if I remember correctly). 
Real issue is this nasty bug affecting dependency management in general 
- not only the optional flag. Please see this pom.xml:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>localhost</groupId>
   <artifactId>MNG-5227</artifactId>
   <version>1-SNAPSHOT</version>

   <dependencyManagement>
     <dependencies>
       <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-lang3</artifactId>
         <scope>test</scope>
       </dependency>
     </dependencies>
   </dependencyManagement>

   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-model</artifactId>
       <version>3.3.9</version>
     </dependency>
   </dependencies>
</project>

The scope of 'commons-lang3' is managed to 'test'. That scope is not 
transitive. Executing 'mvn-3.3.9 dependency:tree' (and all other Maven 
versions >= 2) incorrectly contains that dependency and produces:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ MNG-5227 ---
[INFO] localhost:MNG-5227:jar:1-SNAPSHOT
[INFO] \- org.apache.maven:maven-model:jar:3.3.9:compile
[INFO]    +- org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
[INFO]    \- org.apache.commons:commons-lang3:jar:3.4:test

See that 'test' scope. That's just not correct. The transitive 'test' 
dependency should not be there since the 'test' scope is not transitive. 
With the Aether patch applied executing 'mvn-3.4.0-SNAPSHOT 
dependency:tree' now produces the correct graph:

[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) @ MNG-5227 ---
[INFO] localhost:MNG-5227:jar:1-SNAPSHOT
[INFO] \- org.apache.maven:maven-model:jar:3.3.9:compile
[INFO]    \- org.codehaus.plexus:plexus-utils:jar:3.0.22:compile

Same for the 'optional' flag. Not having an option to manage the 
'optional' flag really is an issue. Either you need to manage it to 
'false', to include a transitive dependency flagged optional or you need 
to manage it to 'true' to exclude a transitive dependency you do not 
need (or which should have been flagged optional but isn't). When Maven 
was approaching 3.0, Aether wasn't supporting it.

Regards,
-- 
Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [jira] [Reopened] (MNG-5227) The 'optional' flag of a dependency should be manageable.

Posted by Robert Scholte <rf...@apache.org>.
Hi,
What interested me is that is seems to be the intention to NOT manage the  
optional flag.[1]
Why would you set the optional flag when using dependency management?

this just means, that if you want to use this dependency, you explicitly  
need to set the optional to false? That doesn't feel right.
Instead I would expect that in case of dependencyManagement you cannot set  
the optional-tag.

Or am I missing something?

thanks,
Robert

[1] https://issues.apache.org/jira/browse/MNG-4600


Op Thu, 28 Jan 2016 17:49:38 +0100 schreef Christian Schulte  
<sc...@apache.org>:

> Can someone please take a look at this? MNG-5227 is already checked in  
> (with IT) and I would not want to revert it. It is triggering a bug in  
> Aether I just reported and provided a patch for. How to procceed?
>
>
> Am 01/28/16 um 17:37 schrieb Christian Schulte (JIRA):
>>
>>       [  
>> https://issues.apache.org/jira/browse/MNG-5227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel  
>> ]
>>
>> Christian Schulte reopened MNG-5227:
>> ------------------------------------
>>
>> This issue is blocked by [Aether Bug  
>> 486740|https://bugs.eclipse.org/bugs/show_bug.cgi?id=486740].
>>
>>> The 'optional' flag of a dependency should be manageable.
>>> ---------------------------------------------------------
>>>
>>>                  Key: MNG-5227
>>>                  URL: https://issues.apache.org/jira/browse/MNG-5227
>>>              Project: Maven
>>>           Issue Type: Bug
>>>           Components: Artifacts and Repositories
>>>     Affects Versions: 3.0.3
>>>             Reporter: Christian Schulte
>>>             Assignee: Christian Schulte
>>>             Priority: Minor
>>>              Fix For: 3.4.0
>>>
>>>
>>> {code}
>>> <dependencyManagement>
>>>    <dependencies>
>>>      <dependency>
>>>        <groupId>groupId</groupId>
>>>        <artifactId>artifactId</artifactId>
>>>        <version>version</version>
>>>        <optional>false</optional> <!-- Ignored by Maven 2 & 3 in  
>>> dependency management. -->
>>>      </dependency>
>>>    </dependencies>
>>> </dependencyManagement>
>>> {code}
>>
>>
>>
>> --
>> This message was sent by Atlassian JIRA
>> (v6.3.4#6332)
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org