How do I know which JAR application is not in use?

In our application, a large number of JAR files were assembled during the development process. How can I filter out those that are no longer used by the application? On some easy way?

+5
source share
5 answers

If you are sure that you can use your application to use all its banks, you can create a simple perl script:

while (<>) {
    $l{$1}++ if m/\s+from\s+(.+\.jar)/;
}

for $l (keys(%l)) {
    print "$l\n";
}

(let's call it list_jars.pl) and give it the output of a detailed run:

java -verbose -jar YOUR_APP.jar | perl list_jars.pl

which should contain a list of all loaded classes.

+3
source

maven, mojo : mvn dependency: anal , , . - ...

+1

stan. java, .

, , .

+1

script, , . script . bash/python.

(. ).

0

Maybe you could write your own ClassLoader, inheriting from java.lang.ClassLoader, which registers the paths of loaded classes? This still does not solve the problem of ensuring full coverage of all classes loaded in all possible code paths, although

0
source

All Articles