Skip to content

Unnecessary transitive dependencies pulled in through this lib #18

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

Open
grimsa opened this issue Mar 28, 2019 · 1 comment
Open

Unnecessary transitive dependencies pulled in through this lib #18

grimsa opened this issue Mar 28, 2019 · 1 comment

Comments

@grimsa
Copy link
Collaborator

grimsa commented Mar 28, 2019

When json-snapshot is added to a project, it pulls a number of dependencies (see output of mvn dependency:tree:

[INFO] \- io.github.json-snapshot:json-snapshot:jar:1.0.16:test
[INFO]    +- org.apache.commons:commons-lang3:jar:3.7:test
[INFO]    +- org.mockito:mockito-junit-jupiter:jar:2.23.0:test
[INFO]    +- org.junit.platform:junit-platform-runner:jar:1.2.0:test
[INFO]    |  +- org.junit.platform:junit-platform-launcher:jar:1.2.0:test
[INFO]    |  \- org.junit.platform:junit-platform-suite-api:jar:1.2.0:test
[INFO]    \- org.junit.vintage:junit-vintage-engine:jar:5.1.0:test

Most of them should not be needed on the test classpath of the project using this lib.
E.g. I want to use JUnit 5 in my project and NOT have JUnit 4 on classpath (to avoid accidentally mixing up annotations from different versions). This is currently not possible, as if I exclude JUnit 4 from json-snapshot dependency, then io.github.jsonSnapshot.SnapshotMatcher#hasTestAnnotation fails.

The check which classes are available on classpath should be string-based (i.e. if the annotation class is not available, json-snapshot should simply not look for that on test methods).

@grimsa
Copy link
Collaborator Author

grimsa commented Feb 17, 2020

Workaround that allows to exclude JUnit 4 in Gradle projects:

configurations.all {
    exclude group: 'junit', module: 'junit'
}

dependencies {
    // ... your dependencies

    testRuntimeOnly 'junit:junit:4.12'
}

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

1 participant