In big projects, with lots of dependencies, the WEB-INF/lib folder is often crowded with jars. I really feel that there is a lot more than we use.
As our project is getting close to production, it’s time for a cleanup. But is there a tool, or a method, for doing this cleanup and ensuring (or maximizing the chances) that nothing breaks in the code ?
That’s almost impossible. There may be dependencies which are accessed by reflection. No one static code analyzer can check this reliably.
Your best bet is really to remove all the JAR’s and unit-test (create unit tests if not done yet) as long as until you get a
ClassNotFoundExceptionorNoClassDefFoundErrorand then add the JAR containing the class in question.To avoid this kind of problems in the future, consider a dependency manager like Maven or Ivy.