[英]What are the differences between javadoc.jar, sources.jar and .jar?
Looking at Google gson 2.8.5 , I see several jars are distributed herehttps://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/查看 Google gson 2.8.5 ,我看到这里分发了几个 jarhttps://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/
By reading other posts, I understand that sources.jar contains source code, but jar contains the compiled class files.通过阅读其他帖子,我了解到sources.jar包含源代码,但jar包含编译后的类文件。
Does this mean that, given the sources.jar, I can generate the jar myself?
这是否意味着,给定sources.jar,我可以自己生成jar?
Yes, you could extract the Java code from the sources.jar using the jar
command.是的,您可以使用
jar
命令从 sources.jar 中提取 Java 代码。
Eg jar xf gson-2.8.5-sources.jar
例如
jar xf gson-2.8.5-sources.jar
And than compiling the Java files using javac
.而不是使用
javac
编译 Java 文件。
But you need to have all the referenced dependencies in your classpath which are required when you call javac.但是您需要在类路径中拥有调用 javac 时所需的所有引用依赖项。 These dependencies can be found in the project pom.xml
这些依赖可以在项目pom.xml 中找到
What is the general relationship between these three jars?
这三个罐子的大致关系是什么?
The .jar file contains the compliled code which is contained in the sources.jar. .jar 文件包含sources.jar 中包含的编译代码。 So using the sources.jar you could create the .jar yourself (as mentioned having the required dependencies).
因此,使用sources.jar,您可以自己创建.jar(如上所述具有所需的依赖项)。 The javadoc.jar contains a static html site which content is extracted from all the javadocs which are present in the Java source files.
javadoc.jar 包含一个静态 html 站点,该站点的内容是从 Java 源文件中存在的所有 javadoc 中提取的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.