How to check the required libraries?

I am developing a web application with a lot of libraries like Spring, Apache CXF, Hibernate, Apache Axis, Apache Common, etc. Each of these frameworks has many * .jar libraries.

For development, I just take all the delivered libraries and add them to my classpath.

For deployment, not all of these libraries are necessary, so is there a quick way to learn all the necessary libraries (* .jar) that are used by my source code?

+3
source share
4 answers

If you move your project to using Maven, this will be simplified:

mvn dependency:analyze 
mvn dependency:tree
+3
source

For your example, Maven + IDE + nice dependency diagrams can help highlight.

. : , , " " - , .

+1

JDepend Java Java. JDepend , .

0

, , , Eclipse:

  • .
  • # 2 .
  • , , . .
  • Control-Shift-T . , , № 1.
  • , , № 2, 3 4 , .

, , jar . :

  • , . , .

  • Launch the application and see if you have any ClassNotFoundExceptions. If you do, use Control-Shift-T to find out which jar this class comes from and add it to your classpath. Repeat until your project is launched without any ClassNotFoundExceptions.

The problem with # 2 is that you really don’t know that you have resolved all the dependencies, since you cannot imitate all the possible execution paths that your project might need.

0
source

Source: https://habr.com/ru/post/1755976/


All Articles