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

Thorsten Glaser commented on MDEP-791:
--------------------------------------

I don’t really disagree, but my understanding of the current Maven model means 
I cannot fully agree either.

You say “Saying that the top-level project depends on an artifact with test 
scope”, but this is not what we say (at least not in 
{{{}<dependencyManagement>{}}}). Rather, we say “the artefact FOO is available 
in the following scopes: test”.

I actually rely on the ability to override things from external dependencies 
_quite_ a lot. Hmm, perhaps {{<exclude>}} would suffice… but, hm, no. I can 
mentally construct something where I would want an implicit (or explicit) 
dependency available at test time but not at compile or runtime; for example, 
consider you use some kind of framework that normally pulls in its own logging, 
and that’s okay to test my (jar) module, but otherwise (at least at runtime) I 
provide the necessary things on my own (or don’t even need to because it uses 
reflection so just removing the default dependency will change the features but 
still work).

Perhaps we need a way to specify scopes as either “add to” or “set to”. (A more 
flexible scope specification would also make it possible, for example, to set 
something to compile+test but not runtime, or the other way around. Currently 
we’re limited to a set of choices that set the module-in-scope bitmask to 
certain values, which is less flexible.)

Additionally, I’d argue (and I’m sure people like [~chonton] would do that even 
more vegemently) that changing anything in the way Maven resolution works is 
something for a 4.x and you should try to work within the 3.x model in updates 
of this plugin, *especially* considering the last _working_ version of MDEP 
does not work with contemporary supported JDK versions and so people _direly_ 
need an updated _working_ version.

> Non-test scoped and transitive dependencies in compile scope
> ------------------------------------------------------------
>
>                 Key: MDEP-791
>                 URL: https://issues.apache.org/jira/browse/MDEP-791
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 3.2.0, 3.3.0
>            Reporter: Slawomir Jaranowski
>            Priority: Critical
>         Attachments: MDEP-791.zip
>
>
> When we use some dependency in test classes which is not used in production 
> code but is required as transitive dependency for other used in production 
> code - such dependency should not be included in {*}{{Non-test scoped}}{*}.
> Example:
>  * test code use {{ObjectCodec}} from {{jackson-core}}
>  * production code use only {{ObjectMapper}} from {{jackson-databind}}
>  * production code don't use any classes from {{jackson-core}}
> {{jackson-core}} is needed by {{jackson-databind}} and must by in compile 
> scope so should not be reported as {{Non-test scoped}}
>  



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

Reply via email to