[
https://issues.apache.org/jira/browse/MDEP-791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493270#comment-17493270
]
Slawomir Jaranowski commented on MDEP-791:
------------------------------------------
Test project in attachment [^MDEP-791.zip]
Step to reproduce
h2. {{jackson-core}} no on direct dependency
{code}
mvn clean verify
INFO] --- maven-dependency-plugin:3.3.0-SNAPSHOT:analyze-only
(check-dependencies) @ tstp ---
[WARNING] Used undeclared dependencies found:
[WARNING] com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile
[WARNING] Non-test scoped test only dependencies found:
[WARNING] com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{code}
h2. {{jackson-core}} with compile scope
{code}
mvn clean verify -P core-compile
INFO] --- maven-dependency-plugin:3.3.0-SNAPSHOT:analyze-only
(check-dependencies) @ tstp ---
[WARNING] Non-test scoped test only dependencies found:
[WARNING] com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{code}
h2. {{jackson-core}} with test scope
{code}
mvn clean verify -P core-test
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] .../tj/src/main/java/tstp/MDEP753.java:[9,48] cannot access
com.fasterxml.jackson.core.Versioned
class file for com.fasterxml.jackson.core.Versioned not found
[INFO] 1 error
{code}
*How to make build pass without exclusion artifacts from analysis?*
Maybe I do something in wrong way ...
> 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
> 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)