使用ANT从javadoc生成中排除一些源文件

时间:2012-08-01 10:46:24

标签: java ant javadoc

  

可能重复:
  How can I make an Ant Javadoc class exclude two files?

我想排除一些eclipse相关文件的javadoc生成,比如我的ant javadoc目标中的Activator.java。我有下面的代码示例,它为单个文档下的不同java项目生成javadoc。

<project basedir="." default="jdoc" name="ANT_TASK">
<target description="creates the javadoc for the XXXXX module" name="jdoc">
      <javadoc
               destdir="docs/api"
               use="true"
               public="true"
               splitindex="true"
               classpath="..\com.sample.script.modules\bin"
               packagenames="com.sample.package1,
                             com.sample.test1"
               windowtitle="XXXXX 1.0 API"> 
        <sourcepath>
              <pathelement path="..\com.sample.package\src"/>
              <pathelement path="..\com.sample.test\src"/>        
        </sourcepath>
        <doctitle><![CDATA[<h1>XXXXX 1.0 API</h1>]]></doctitle>
        <bottom><![CDATA[<i>Copyright &#169; 1999-2012 XXXX company Ltd. All Rights Reserved.</i>]]></bottom>
      </javadoc>
</target>
</project>

任何人都可以帮助我如何从javadoc生成中排除Activator.java文件。

1 个答案:

答案 0 :(得分:0)

直接从javadoc ant任务:

  

<fileset dir="src" defaultexcludes="yes">
  <include name="com/dummy/test/**"/>
  <exclude name="com/dummy/test/doc-files/**"/>
</fileset>

<doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2000 Dummy Corp. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Group 1 Packages" packages="com.dummy.test.a*"/>
<group title="Group 2 Packages" packages="com.dummy.test.b*:com.dummy.test.c*"/>
<link offline="true" href="http://download.oracle.com/javase/6/docs/api/" packagelistLoc="C:\tmp"/>
<link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>

所以我会把文件放到文件集的排除列表中。