如何构建我的 jar 文件,以便使用该库的用户能够在 Eclipse 中看到 javadoc
我正在开发一个供公司内部使用的小型图书馆,并且已经对其进行了大量记录.现在我正在使用以下代码构建我的 jar:
I'm working on a small library for our in-company use, and have been heavily documenting it. Now I'm building my jar with the following code:
<project name="commonutils" default="compile" basedir=".">
<property name="src" location="src" />
<property name="build" location="buildDirecotry" />
<target name="compile">
<delete file="${ant.project.name}.jar" />
<mkdir dir="${build}"/>
<javac srcdir="${src}" destdir="${build}" debug="on" target="1.5">
<classpath>
<pathelement location="lib/build/server.zip" />
<pathelement path="${java.class.path}/"/>
</classpath>
</javac>
<jar basedir="${build}" destfile="${ant.project.name}.jar" />
<delete dir="${build}" />
</target>
</project>
工作正常,它使用其中的所有 src 文件构建我的 jar 文件,但是当我将 jar 文件包含在另一个项目中时,我不再有任何 javadoc 注释.使用 JDDecompiler 我看不到类文件中的注释,尽管我不确定是剥离它们的 Java 编译器还是 JD.
Which works fine, it builds my jar file with all the src files in it, but when I include the jar file in another project I no-longer have any of my javadoc comments. Using JDDecompiler I cannot see the comments in the class file, although I'm not sure if its the java compiler that's stripping them or JD.
我的问题是:如何构建我的 jar 文件,以便使用该库的用户能够在 Eclipse 中看到 javadoc.
My question is: How can I build my jar file so that users who use the library will be able to see the javadoc in Eclipse.
如果将源文件包含在 jar 中(每个类和 java 文件都在同一个包目录中),它应该可以工作.
If you include the source files in the jar (each class and java file in the same package-directory) it should work.
<target name="jar.noCompile.src">
<jar destfile="${ant.project.name}.jar">
<fileset dir="${build}"/>
<fileset dir="${src}" includes="**/*.java"/>
</jar>
</target>