Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 brought in by maven as a transitive dependency)?

Can anyone help me know why some one needs asm jar?

Thanks in advance !

EDIT: Can you also mention for what purposes/use-cases one might need asm jar?

like image 601
peakit Avatar asked Nov 25 '09 17:11

peakit


People also ask

Does JAR file contain dependencies?

The difference is that the Maven Assembly Plugin will automatically copy all required dependencies into a jar file. In the descriptorRefs part of the configuration code, we provided the name that will be added to the project name. Output in our example will be named as core-java-jar-with-dependencies. jar.

What is dependency jar?

jar-dependencies 0.4. 1 it warns on version conflicts and loads only ONE jar assuming the first one is compatible to the second one otherwise your project needs to lock down the right version by providing a Jars. lock file.

What is ASM jar used for?

It can be used to modify existing classes or to dynamically generate classes, directly in binary form. ASM provides some common bytecode transformations and analysis algorithms from which custom complex transformations and code analysis tools can be built.


2 Answers

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.

like image 182
Pascal Thivent Avatar answered Sep 23 '22 05:09

Pascal Thivent


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.

like image 44
Anthony Forloney Avatar answered Sep 25 '22 05:09

Anthony Forloney