ASM jar - 为什么我的 java 项目依赖于此?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1798724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ASM jar - Why my java project has a dependency on this?
提问by peakit
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)?
我有一个 Java 项目,在内部它依赖于asm jar. 奇怪的是,我什至不知道为什么我的项目以某种方式依赖于这个库(可能由 maven 作为传递依赖引入)?
Can anyone help me know why some one needs asm jar?
谁能帮我知道为什么有人需要 asm jar?
Thanks in advance !
提前致谢 !
EDIT:Can you also mention for what purposes/use-cases one might need asm jar?
编辑:您能否还提到可能需要 asm jar 的目的/用例?
回答by Pascal Thivent
ASMis a bytecode manipulation framework (see this pagefor 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 usersorganized by category, check it out.
ASM是一个字节码操作框架(请参阅此页面以获得很好的介绍)并且被许多执行...字节码操作的事物使用:使用代理生成和反射的框架(Spring、Hibernate 等)、模拟框架(EasyMock、JMock 等) )、代码分析工具(PMD、Findbugs等)。实际上,ASM 项目维护了一个按类别组织的用户列表,请查看。
As mentioned by Vincent, if you are depending transitively on ASM, the dependency:treegoal 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.
正如 Vincent 所提到的,如果您传递地依赖于 ASM,dependency:tree目标或依赖关系报告(参见上面的 PMD 和 Findbugs 链接示例)可以帮助分析情况并找出它的来源。但这不会考虑您正在使用的 maven 插件的依赖项,只考虑您项目的依赖项。
回答by Anthony Forloney
Maven-2 requires asm.jarto compile and run the application.
Maven-2 需要asm.jar编译和运行应用程序。
Herefor 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.
由于程序分析、生成和转换技术的许多可能用途,已经实现了许多用于分析、生成和转换程序的工具,包括 Java 在内的许多语言。ASM 是 Java 语言的这些工具之一,专为运行时(但也可脱机)类生成和转换而设计。因此,ASM1 库旨在处理已编译的 Java 类。它还被设计为尽可能快和尽可能小。尽可能快是很重要的,以免在运行时使用 ASM 的应用程序减慢太多,以进行动态类生成或转换。为了在内存受限的环境中使用,并避免使用 ASM 的小型应用程序或库的大小膨胀,尽可能小很重要。ASM 不是生成和转换已编译 Java 类的唯一工具,但它是最新和最有效的工具之一。它可以从http://asm.objectweb.org。其主要优点如下: 1) 具有简单、设计良好的模块化API,易于使用。2)它有很好的文档记录并且有一个相关的 Eclipse 插件。3) 它提供对最新 Java 版本 Java 6 的支持。 4) 它体积小、速度快且非常健壮。5)其庞大的用户社区可以为新用户提供支持。6) 它的开源许可证允许您以几乎任何方式使用它。
Found from thispdf 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.
从发现该PDF文件。我的印象是,Java EE 6 还附带了一个内置工具,用于类生成和转换的 ASM。PDF 为您提供了有关 ASM 的更深入的详细信息。
Hope this helps.
希望这可以帮助。
回答by Vincent Ramdhanie
It is possible to use the dependency pluginfor Maven to see which library has asm as a dependency.
可以使用Maven的依赖插件来查看哪个库有asm作为依赖。
回答by Brian Agnew
What other dependencies does your project have ? I suspect one of the jars you've decided you require (e.g. Spring or Hibernate) itselfrequires asm.jar ?
您的项目还有哪些其他依赖项?我怀疑您决定需要的罐子之一(例如 Spring 或 Hibernate)本身需要 asm.jar ?

