Maxim Muzafarov created CASSANDRA-18777:
-------------------------------------------

             Summary: Revise unused project dependencies
                 Key: CASSANDRA-18777
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18777
             Project: Cassandra
          Issue Type: Task
            Reporter: Maxim Muzafarov


There are some project dependencies that are no longer used, but they are still 
declared in the parent pom. I think we can revise the project dependencies and 
clean up the ones that are not used.

There are two issues here:
- deleting unused dependencies - it should be agreed by the community in 
advance;
- adding an automation check to prevent the same problem in the future;

As a naive approach to finding the list of unused dependencies, the {{mvn 
dependency:analyze}} command can be used. The command will not outline the list 
of dependencies to remove, as some of them may only be used at runtime, so the 
list should be considered cautiously. We put the built classes in the 
{{build/classes}} and {{build/test/classes}} directories, which won't work for 
the maven dependency plugin because it expects the built classes to be in the 
{{target/classes}} directory - to trick that, we can copy them all there and 
run the plugin against the built pom file. Below you can find commands to 
reproduce the result and the result itself.

h3. The command

Tested on the latest trunk (commons-codec is there).
{code}
# copy packages to the build/target/classes to run maven
for d in `find ./build/classes -maxdepth 2 -type d -name org -or -name com`; do 
`rsync -a $d ./build/target/classes`; done

mvn -f ./build/apache-cassandra-5.0-SNAPSHOT.pom 
org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze -Dverbose=true 
-DignoreNonCompile
{code}

h3. The result

{code}
[WARNING] Used undeclared dependencies found:
[WARNING]    io.netty:netty-handler:jar:4.1.96.Final:compile
[WARNING]    io.netty:netty-common:jar:4.1.96.Final:compile
[WARNING]    io.netty:netty-buffer:jar:4.1.96.Final:compile
[WARNING]    io.netty:netty-codec:jar:4.1.96.Final:compile
[WARNING]    org.checkerframework:checker-qual:jar:3.10.0:compile
[WARNING]    io.netty:netty-transport:jar:4.1.96.Final:compile
[WARNING]    
io.netty:netty-transport-native-unix-common:jar:4.1.96.Final:compile
[WARNING]    io.netty:netty-transport-classes-epoll:jar:4.1.96.Final:compile
[WARNING] Unused declared dependencies found:
[WARNING]    com.github.jnr:jffi:jar:native:1.3.11:compile
[WARNING]    net.openhft:affinity:jar:3.23.3:compile
[WARNING]    org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[WARNING]    io.netty:netty-transport-native-epoll:jar:4.1.94.Final:compile
[WARNING]    com.github.jnr:jnr-constants:jar:0.10.4:compile
[WARNING]    io.dropwizard.metrics:metrics-logback:jar:3.1.5:compile
[WARNING]    org.antlr:ST4:jar:4.0.8:compile
[WARNING]    org.gridkit.jvmtool:mxdump:jar:0.14:compile
[WARNING]    io.netty:netty-tcnative-boringssl-static:jar:2.0.61.Final:compile
[WARNING]    com.google.j2objc:j2objc-annotations:jar:1.3:compile
[WARNING]    org.gridkit.lab:jvm-attach-api:jar:1.5:compile
[WARNING]    org.gridkit.jvmtool:sjk-json:jar:0.14:compile
[WARNING]    org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[WARNING]    com.github.jnr:jnr-ffi:jar:2.2.13:compile
[WARNING]    commons-codec:commons-codec:jar:1.9:compile
[WARNING]    org.caffinitas.ohc:ohc-core-j8:jar:0.5.1:compile
[WARNING]    org.bouncycastle:bcpkix-jdk15on:jar:1.70:compile
[WARNING]    net.java.dev.jna:jna-platform:jar:5.13.0:compile
[WARNING]    com.github.jnr:jffi:jar:1.3.11:compile
[WARNING]    io.netty:netty-all:jar:4.1.96.Final:compile
[WARNING]    org.gridkit.jvmtool:sjk-stacktrace:jar:0.14:compile
[WARNING]    
io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.94.Final:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to