I'm building jars where I want to package them without sources but I would like the javadoc to come up for developers in eclipse.
我正在构建我想要在没有源代码的情况下打包它们的jar,但是我想在eclipse中为开发人员提供javadoc。
5 个解决方案
#1
What is your build process? The Maven release process actually generates 3 jars, one containing the compiled classes, one with sources and one with javadocs. You should be able to customize the POM to prevent distribution of the source jar, and anyone using Maven to manage dependencies will automatically get the javadoc if they declare a dependency on your jar (and have javadoc downloading turned on in the eclipse maven plugin).
你的构建过程是什么? Maven发布过程实际上生成了3个jar,其中一个包含已编译的类,一个包含源,另一个包含javadoc。您应该能够自定义POM以防止分发源jar,并且任何使用Maven来管理依赖关系的人都会自动获取javadoc,如果他们声明了对jar的依赖(并且在eclipse maven插件中启用了javadoc下载)。
#2
The users of your JAR can associate a Javadoc location (URL, file or path inside an archive) to it in the Java Build Path properties of the Java project, where the JAR is used.
I'm not sure how well this would work with the Javadoc in the same JAR as the binaries (never seen that before), but in theory it should work.
JAR的用户可以在使用JAR的Java项目的Java Build Path属性中将Javadoc位置(存档中的URL,文件或路径)与其关联。我不确定这对Javadoc在同一个JAR中的效果与二进制文件(之前从未见过)有关,但理论上它应该可行。
#3
Apache Ant javadoc task will produce API html. Normally you would then distribute this as a zip file along with your jars.
Apache Ant javadoc任务将生成API html。通常,您会将其作为zip文件与您的罐子一起分发。
#4
Javadocs are part of the source code, as any compiled class won't contain any comment - Javadocs are comments.
Javadocs是源代码的一部分,因为任何编译的类都不包含任何注释 - Javadocs是注释。
In other words, you can't.
换句话说,你做不到。
#5
JIDE have a tool (costs $25) that will run over your source code and strip out all the method bodies, leaving the javadoc in, and produces a zip file. You can then distribute this zip as a source zip, and your IDE will be able to read the javadocs, but of course all your logic has been removed so you can retain your closed-sourceness. Any private members and methods are not included in the zip file.
JIDE有一个工具(成本25美元),它将运行你的源代码并删除所有方法体,留下javadoc,并生成一个zip文件。然后,您可以将此zip文件作为源zip分发,并且您的IDE将能够读取javadoc,但当然您的所有逻辑都已删除,因此您可以保留您的闭源。 zip文件中不包含任何私有成员和方法。
It also has the added bonus of retaining method parameter names for intellisense, so the following method
它还具有保留intellisense方法参数名称的额外好处,因此以下方法
public void foo( String text, Integer index ) {
}
will show foo( String text, Integer index ) when you auto-complete, instead of foo( String arg1, Integer arg2 ) so you can hint what the parameters should be.
当你自动完成时会显示foo(String text,Integer index),而不是foo(String arg1,Integer arg2),所以你可以提示参数应该是什么。
#1
What is your build process? The Maven release process actually generates 3 jars, one containing the compiled classes, one with sources and one with javadocs. You should be able to customize the POM to prevent distribution of the source jar, and anyone using Maven to manage dependencies will automatically get the javadoc if they declare a dependency on your jar (and have javadoc downloading turned on in the eclipse maven plugin).
你的构建过程是什么? Maven发布过程实际上生成了3个jar,其中一个包含已编译的类,一个包含源,另一个包含javadoc。您应该能够自定义POM以防止分发源jar,并且任何使用Maven来管理依赖关系的人都会自动获取javadoc,如果他们声明了对jar的依赖(并且在eclipse maven插件中启用了javadoc下载)。
#2
The users of your JAR can associate a Javadoc location (URL, file or path inside an archive) to it in the Java Build Path properties of the Java project, where the JAR is used.
I'm not sure how well this would work with the Javadoc in the same JAR as the binaries (never seen that before), but in theory it should work.
JAR的用户可以在使用JAR的Java项目的Java Build Path属性中将Javadoc位置(存档中的URL,文件或路径)与其关联。我不确定这对Javadoc在同一个JAR中的效果与二进制文件(之前从未见过)有关,但理论上它应该可行。
#3
Apache Ant javadoc task will produce API html. Normally you would then distribute this as a zip file along with your jars.
Apache Ant javadoc任务将生成API html。通常,您会将其作为zip文件与您的罐子一起分发。
#4
Javadocs are part of the source code, as any compiled class won't contain any comment - Javadocs are comments.
Javadocs是源代码的一部分,因为任何编译的类都不包含任何注释 - Javadocs是注释。
In other words, you can't.
换句话说,你做不到。
#5
JIDE have a tool (costs $25) that will run over your source code and strip out all the method bodies, leaving the javadoc in, and produces a zip file. You can then distribute this zip as a source zip, and your IDE will be able to read the javadocs, but of course all your logic has been removed so you can retain your closed-sourceness. Any private members and methods are not included in the zip file.
JIDE有一个工具(成本25美元),它将运行你的源代码并删除所有方法体,留下javadoc,并生成一个zip文件。然后,您可以将此zip文件作为源zip分发,并且您的IDE将能够读取javadoc,但当然您的所有逻辑都已删除,因此您可以保留您的闭源。 zip文件中不包含任何私有成员和方法。
It also has the added bonus of retaining method parameter names for intellisense, so the following method
它还具有保留intellisense方法参数名称的额外好处,因此以下方法
public void foo( String text, Integer index ) {
}
will show foo( String text, Integer index ) when you auto-complete, instead of foo( String arg1, Integer arg2 ) so you can hint what the parameters should be.
当你自动完成时会显示foo(String text,Integer index),而不是foo(String arg1,Integer arg2),所以你可以提示参数应该是什么。