Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected junit transitive dependency in 2.12.1 #672

Closed
nesterov-n opened this issue Jan 27, 2021 · 6 comments
Closed

unexpected junit transitive dependency in 2.12.1 #672

nesterov-n opened this issue Jan 27, 2021 · 6 comments

Comments

@nesterov-n
Copy link

com.fasterxml.jackson.core:jackson-core:2.12.1 brings transitive dependency on junit to my android project based on gradle.

fragment of ./gradlew app:dependencies command output:

+--- com.fasterxml.jackson.core:jackson-core:2.12.1
|    \--- com.fasterxml.jackson:jackson-bom:2.12.1
|         +--- junit:junit:4.13.1 -> 4.12 (c)
|         \--- com.fasterxml.jackson.core:jackson-core:2.12.1 (c)

Is this intended behaviour?

Version 2.11.4 brings no transitive dependencis at all.

@cowtowncoder
Copy link
Member

cowtowncoder commented Jan 27, 2021

Junit should only be depended on in "test" scope, and jackson-bom should not add anything to any scope (but only define expected version under dependencyManagement section). jackson-base does add dependency in test scope.

So the first thing would be check dependency scope. Gradle and Maven have a bit different definitions so I wonder if that could play a role.

Another possible thing wrt 2.12 is that addition of "gradle module metadata" could have affected something (it did not exist in 2.11).

But first I'd double check what scope this would be.

@rwanderc
Copy link

rwanderc commented Feb 8, 2021

I couldn't reproduce it, either in Maven or Gradle.

Maven

<?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>com.wandercosta</groupId>
    <artifactId>jackson-example</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.12.1</version>
        </dependency>
    </dependencies>
</project>

Ran mvn dependency:tree -Dverbose and only jackson-core is mentioned.

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.wandercosta:jackson-example >-------------------
[INFO] Building jackson-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ jackson-example ---
[INFO] com.wandercosta:jackson-example:jar:1.0-SNAPSHOT
[INFO] \- com.fasterxml.jackson.core:jackson-core:jar:2.12.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.966 s
[INFO] Finished at: 2021-02-08T08:02:46+01:00
[INFO] ------------------------------------------------------------------------

Gradle

plugins {
    id 'java'
}

group 'com.wandercosta.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.1'
}

Ran ./gradlew dependencies and only jackson-core and bom are mentioned.


> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies

apiElements - API elements for main. (n)
No dependencies

archives - Configuration for archive artifacts. (n)
No dependencies

compileClasspath - Compile classpath for source set 'main'.
\--- com.fasterxml.jackson.core:jackson-core:2.12.1
     \--- com.fasterxml.jackson:jackson-bom:2.12.1
          \--- com.fasterxml.jackson.core:jackson-core:2.12.1 (c)

compileOnly - Compile only dependencies for source set 'main'. (n)
No dependencies

default - Configuration for default artifacts. (n)
No dependencies

implementation - Implementation only dependencies for source set 'main'. (n)
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
\--- com.fasterxml.jackson.core:jackson-core:2.12.1
     \--- com.fasterxml.jackson:jackson-bom:2.12.1
          \--- com.fasterxml.jackson.core:jackson-core:2.12.1 (c)

runtimeElements - Elements of runtime for main. (n)
No dependencies

runtimeOnly - Runtime only dependencies for source set 'main'. (n)
No dependencies

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies

testCompileClasspath - Compile classpath for source set 'test'.
\--- com.fasterxml.jackson.core:jackson-core:2.12.1
     \--- com.fasterxml.jackson:jackson-bom:2.12.1
          \--- com.fasterxml.jackson.core:jackson-core:2.12.1 (c)

testCompileOnly - Compile only dependencies for source set 'test'. (n)
No dependencies

testImplementation - Implementation only dependencies for source set 'test'. (n)
No dependencies

testRuntimeClasspath - Runtime classpath of source set 'test'.
\--- com.fasterxml.jackson.core:jackson-core:2.12.1
     \--- com.fasterxml.jackson:jackson-bom:2.12.1
          \--- com.fasterxml.jackson.core:jackson-core:2.12.1 (c)

testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
No dependencies

(c) - dependency constraint
A web-based, searchable dependency report is available by adding the --scan option.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 607ms
1 actionable task: 1 executed

@cowtowncoder
Copy link
Member

Strange. I will leave this open for a bit in case anyone else can shed a light but may close later on.

@cowtowncoder
Copy link
Member

Not much to go on about -- may be re-opened with reproduction or more info, but closing for now.

@akvone
Copy link

akvone commented Sep 19, 2021

Hello,
It seems that jackson:2.12 may bring junit into the classpath under some complex circumstances. See the issue

@cowtowncoder
Copy link
Member

Probably this:

FasterXML/jackson-bom#43

which was just resolved for 2.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants