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

Stamatis Zampetakis commented on MNG-5227:
------------------------------------------

I hit this problem today in the Apache Hive project. To avoid licensing 
problems we declared all JDBC driver dependencies as _runtime_ and _optional_ 
in the dependencyManagement section 
([https://github.com/apache/hive/blob/47c784b46a951d4ee9ce2712f62aa6af92b71395/pom.xml#L1336)].
 It took me a while to understand that actually the optional declaration in 
dependencyManagement is ignored cause for some reason the maven dependency 
plugin was showing that the dependency is optional when running the 
{{dependency:tree}}.

Contrary to what others may think I would argue that this is a bug not a new 
feature. If _optional_ is the only thing that is not handled in the 
{{dependencyManagement}} section then this is quite unexpected. I think it 
definitely deserves a mention in the 
[documentation|https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management]
 till this issue is fixed.

Are there any plans to include this in the next 4 release? Can I help with 
something to move this forward.

> 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: New Feature
>          Components: Artifacts and Repositories
>    Affects Versions: 3.0.3
>            Reporter: Christian Schulte
>            Priority: Minor
>             Fix For: 4.0.x-candidate
>
>         Attachments: MNG-5227.patch, MNG-5227.patch
>
>
> {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
(v8.20.10#820010)

Reply via email to