Maven: Unused dependencies and test-only dependencies
baulea opened this issue · 2 comments
baulea commented
mvn dependency:analyze
lists some used undeclared / unused declared / non-test scoped test only dependencies.
In a first step I would like to
- remove unused declared
- change non-test scoped test only dependencies to scope test
I would be glad if you assign this issue to me.
[INFO] --- maven-dependency-plugin:3.6.1:analyze (default-cli) @ zerocode-tdd ---
[WARNING] Used undeclared dependencies found:
[WARNING] org.slf4j:slf4j-api:jar:1.7.36:compile
[WARNING] com.github.jknack:handlebars:jar:4.0.7:compile
[WARNING] org.apache.commons:commons-lang3:jar:3.7:compile
[WARNING] org.mockito:mockito-core:jar:1.9.5:compile
[WARNING] org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[WARNING] net.minidev:json-smart:jar:2.2.1:compile
[WARNING] javax.inject:javax.inject:jar:1:compile
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile
[WARNING] org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[WARNING] org.jboss.resteasy:jaxrs-api:jar:2.2.1.GA:compile
[WARNING] commons-collections:commons-collections:jar:3.2.1:compile
[WARNING] Unused declared dependencies found:
[WARNING] ch.qos.logback:logback-classic:jar:1.0.7:compile
[WARNING] ch.qos.logback:logback-core:jar:1.0.7:compile
[WARNING] com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.0:compile
[WARNING] com.h2database:h2:jar:1.4.191:test
[WARNING] Non-test scoped test only dependencies found:
[WARNING] org.mockito:mockito-core:jar:1.9.5:compile
[WARNING] org.jukito:jukito:jar:1.4.1:compile
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] --- maven-dependency-plugin:3.6.1:analyze (default-cli) @ http-testing ---
[WARNING] Used undeclared dependencies found:
[WARNING] com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0:compile
[WARNING] org.slf4j:slf4j-api:jar:1.7.36:compile
[WARNING] org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[WARNING] com.fasterxml.jackson.core:jackson-databind:jar:2.10.0:compile
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile
[WARNING] com.github.tomakehurst:wiremock:jar:2.19.0:compile
[WARNING] org.apache.httpcomponents:httpclient:jar:4.5:compile
[WARNING] com.fasterxml.jackson.core:jackson-core:jar:2.10.0:compile
[WARNING] com.google.inject:guice:jar:4.0:compile
[WARNING] Non-test scoped test only dependencies found:
[WARNING] com.fasterxml.jackson.core:jackson-databind:jar:2.10.0:compile
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile
[WARNING] com.fasterxml.jackson.core:jackson-core:jar:2.10.0:compile
INFO] --- maven-dependency-plugin:3.6.1:analyze (default-cli) @ kafka-testing ---
[WARNING] Used undeclared dependencies found:
[WARNING] org.slf4j:slf4j-api:jar:1.7.36:compile
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile
[WARNING] Unused declared dependencies found:
[WARNING] com.google.protobuf:protobuf-java-util:jar:3.13.0:compile
[WARNING] org.apache.kafka:kafka-clients:jar:3.3.1:compile
[WARNING] io.confluent:kafka-avro-serializer:jar:5.1.0:compile
[WARNING] com.github.os72:protoc-jar:jar:3.11.4:compile
[WARNING] Non-test scoped test only dependencies found:
[WARNING] junit:junit:jar:4.12:compile
INFO] --- maven-dependency-plugin:3.6.1:analyze (default-cli) @ zerocode-tdd-jupiter ---
[WARNING] Used undeclared dependencies found:
[WARNING] commons-lang:commons-lang:jar:2.6:compile
[WARNING] org.junit.jupiter:junit-jupiter-api:jar:5.4.2:compile
[WARNING] com.fasterxml.jackson.core:jackson-databind:jar:2.10.0:compile
[WARNING] org.junit.platform:junit-platform-launcher:jar:1.4.2:compile
[WARNING] org.junit.platform:junit-platform-engine:jar:1.4.2:compile
[WARNING] org.slf4j:slf4j-api:jar:1.6.6:compile
[WARNING] junit:junit:jar:4.12:compile
[WARNING] org.apiguardian:apiguardian-api:jar:1.0.0:compile
[WARNING] Unused declared dependencies found:
[WARNING] org.junit.jupiter:junit-jupiter-engine:jar:5.4.2:compile
[WARNING] org.junit.vintage:junit-vintage-engine:jar:5.4.2:compile
[WARNING] org.junit.platform:junit-platform-runner:jar:1.4.2:compile
[WARNING] Non-test scoped test only dependencies found:
[WARNING] commons-lang:commons-lang:jar:2.6:compile
[WARNING] org.junit.jupiter:junit-jupiter-params:jar:5.4.2:compile
[WARNING] junit:junit:jar:4.12:compile
baulea commented
After manual verification I found the following items to reduce complexity:
core/pom.xml:
- set test scope for org.jukito:jukito
- remove com.fasterxml.jackson.datatype:jackson-datatype-jdk8, because it is unused
- remove direct dependency ch.qos.logback:logback-core, because it is a direct dependency from ch.qos.logback:logback-classic and not used in the core project directly
kafka-testing/pom.xml
- remove com.google.protobuf:protobuf-java-util, because it is unused
- remove dependency for com.github.os72:protoc-jar. It is only used as and not additionally as dependency