[ 
https://issues.apache.org/jira/browse/CASSANDRA-18772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755541#comment-17755541
 ] 

Maxim Muzafarov edited comment on CASSANDRA-18772 at 8/17/23 1:42 PM:
----------------------------------------------------------------------

OK, I've found an easy way to find all the unused dependencies, but this list 
should be carefully filtered, as some of the "unused dependencies" may actually 
be used at runtime. I doubt we can add running of this command to the ant build 
as the maven is used.
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
{code}

{code:java}
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:java}
[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] ------------------------------------------------------------------------
{code}

EDITED:

I was confused that the netty-all library was reported in a previous attempt, 
so I've rechecked everything and found the problem with that approach. The mvn 
command tool requires the compiled classes to be in the {{target}} directory, 
but currently they're in classes/<module>, so once I copied them to 
build/target everything started working.


was (Author: mmuzaf):
OK, I've found an easy way to find all the unused dependencies, but this list 
should be carefully filtered, as some of the "unused dependencies" may actually 
be used at runtime. I doubt we can add running of this command to the ant build 
as the maven is used.
h3. The command

Tested on the latest trunk (\{{commons-codec}} is there).

{code:java}
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:java}
[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] ------------------------------------------------------------------------
{code}

EDITED:

I was confused that the netty-all library was reported in a previous attempt, 
so I've rechecked everything and found the problem with that approach. The mvn 
command tool requires the compiled classes to be in the {{target}} directory, 
but currently they're in classes/<module>, so once I copied them to 
build/target everything started working.

> Remove dependency on commons-codec
> ----------------------------------
>
>                 Key: CASSANDRA-18772
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18772
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Dependencies
>            Reporter: Ekaterina Dimitrova
>            Assignee: Ekaterina Dimitrova
>            Priority: Normal
>             Fix For: 5.0.x, 5.x
>
>
> The dependency doesn't seem to have any direct usage in our codebase.
> The only reference to how it might be used was found in CASSANDRA-12790. 
> Considering we also deprecate in 5.0 and remove metrics-reporter-config as 
> part of CASSANDRA-18743, I do not see a reason not to remove this one too. 
> We should probably take the same approach as CASSANDRA-18743 - deprecate in 
> 5.0 and remove in 5.1. ML thread is to be opened too. 



--
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