2009-09-30 12 views
5

AntビルドファイルからJavadocを作成したいが、どこにあるのか分からない。 build.xmlで私は持っています:既存のプロジェクトに対して、antでjavadocを生成するにはどうすればいいですか?

<description> 
    A sample build file for this project 
    </description> 

    <property name="source.dir" location="src"/> 
    <property name="build.dir" location="bin"/> 
    <property name="doc.dir" location="doc"/> 
    <property name="main.class" value="proj1.Proj1"/> 

    <target name="init" description="setup project directories"> 
    <mkdir dir="${build.dir}"/> 
    <mkdir dir="${doc.dir}"/> 
    </target> 

    <target name="compile" depends="init" description="compile java sources"> 
    <javac srcdir="${source.dir}" destdir="${build.dir}"/> 
    </target> 

    <target name="run" description="run the project"> 
    <java dir="${build.dir}" classname="${main.class}" fork="yes"> 
     <arg line="${args}"/> 
    </java> 
    </target> 

    <target name="clean" description="tidy up the workspace"> 
    <delete dir="${build.dir}"/> 
    <delete dir="${doc.dir}"/> 
    <delete> 
     <fileset defaultexcludes="no" dir="${source.dir}" includes="**/*~"/> 
    </delete> 
    </target> 

    <!-- Generate javadocs for current project into ${doc.dir} --> 
    <target name="doc" depends="init" description="generate documentation"> 
    <javadoc sourcepath="${source.dir}" destdir="${doc.dir}"/> 
    </target> 

</project> 

どこにJavadocがありますか?それは隠されたファイルか何かそのディレクトリに置かれていますか?

答えて

14

にjavadocが生成され、docに設定されているdocターゲットが定義されています。

<!-- Generate javadocs for current project into ${doc.dir} --> 
    <target name="doc" depends="init" description="generate documentation"> 
    <javadoc sourcepath="${source.dir}" destdir="${doc.dir}"/> 
    </target> 

ので、Javadocを生成するためには、単に実行します。

$ ant doc 
をそして、あなたは docサブディレクトリにそれを見つけることができます。

0

Eclipseを使用していて、ソースファイルは$ {source.dir} /メインの下にある場合は、この作品:

<target name="doc" depends="init" description="generate documentation"> 
<delete dir="${doc.dir}" /> 
<mkdir dir="${doc.dir}" /> 
    <javadoc destdir="${doc.dir}"> 
     <fileset dir="${source.dir}/main" /> 
    </javadoc> 
</target> 
+0

ところで、それは置く方が良いでしょう '

' 'clean'セクションで... –

関連する問題