我怎样才能建立我的jar文件,这样谁使用这个库的用户将能够看到在Eclipse中的javadoc [英] How can I build my jar file so that users who use the library will be able to see the javadoc in Eclipse

查看:158
本文介绍了我怎样才能建立我的jar文件,这样谁使用这个库的用户将能够看到在Eclipse中的javadoc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我们的公司内部使用的一个小型图书馆,并已严重记录它。现在,我建设我的罐子下面code:

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.

推荐答案

如果您包括在罐子(在同一个包目录每个类和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>  

这篇关于我怎样才能建立我的jar文件,这样谁使用这个库的用户将能够看到在Eclipse中的javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆