ASM jar - Why my java project has a dependency on this?

前端 未结 4 513
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 22:47

I have a Java project and internally it is dependent on asm jar. Strangely, I don\'t even know why my project somehow is dependent on this library (might be bro

相关标签:
4条回答
  • 2021-02-05 22:54

    ASM is a bytecode manipulation framework (see this page for a nice introduction) and is used by many things performing... bytecode manipulation: frameworks using proxy generation and reflection (Spring, Hibernate, etc), mocking frameworks (EasyMock, JMock, etc), code analysis tools (PMD, Findbugs, etc). Actually, the ASM project maintains a list of users organized by category, check it out.

    As mentioned by Vincent, if you are depending transitively on ASM, the dependency:tree goal or the dependency report (see the PMD and Findbugs links above for examples) can help to analyze the situation and to find out from where its coming from. But this won't take into account dependencies of maven plugins that you are using, only dependencies of your project.

    0 讨论(0)
  • 2021-02-05 23:04

    Maven-2 requires asm.jar to compile and run the application.

    Here for more information.

    EDIT:

    Due to the many possible usages of program analysis, generation and transfor- mation techniques, many tools to analyze, generate and transform programs have been implemented, for many languages, Java included. ASM is one of these tools for the Java language, designed for runtime – but also offline – class generation and transformation. The ASM1 library was therefore designed to work on compiled Java classes. It was also designed to be as fast and as small as possible. Being as fast as possible is important in order not to slow down too much the applications that use ASM at runtime, for dynamic class gener- ation or transformation. And being as small as possible is important in order to be used in memory constrained environments, and to avoid bloating the size of small applications or libraries using ASM. ASM is not the only tool for generating and transforming compiled Java classes, but it is one of the most recent and efficient. It can be downloaded from http://asm.objectweb.org. Its main advantages are the following: 1) It has a simple, well designed and modular API that is easy to use. 2) It is well documented and has an associated Eclipse plugin. 3) It provides support for the latest Java version, Java 6. 4) It is small, fast, and very robust. 5) Its large user community can provide support for new users. 6) Its open source license allows you to use it in almost any way you want.

    Found from this pdf file. I am under the impression that along with Java EE 6 also came a built-in tool, ASM for class generation and transformation. The PDF gives you detail in greater depth about ASM.

    Hope this helps.

    0 讨论(0)
  • 2021-02-05 23:09

    What other dependencies does your project have ? I suspect one of the jars you've decided you require (e.g. Spring or Hibernate) itself requires asm.jar ?

    0 讨论(0)
  • 2021-02-05 23:15

    It is possible to use the dependency plugin for Maven to see which library has asm as a dependency.

    0 讨论(0)
提交回复
热议问题