如何在javadoc ant脚本上排除文件

时间:2014-08-01 09:07:47

标签: java eclipse ant

How can I make an Ant Javadoc class exclude two files?

Excluding some source files from javadoc generation using ANT

我遇到了同样的问题,但我还没有解决它......我已经尝试了其中一些解决方案,但没有人为我工作。

我的代码:

<target name="javadocs">
<mkdir dir="${docs.dir}" />
<fileset dir="${project.dir}\src" defaultexcludes="yes">
  <exclude name=".externalToolBuilders\**"/>
</fileset>
<javadoc 
    excludepackagenames=".externalToolBuilders\**"
    sourcepath="${project.dir}" 
    destdir="${docs.dir}" 
    classpath="${project.dir}" 
    author="true" version="true" 
    use="true" 
    doctitle="&lt;h1&gt;${app.name}&lt;/h1&gt;" />

EDIT-1:

我试过这个之后:

<javadoc 
sourcepath="${project.dir}" 
destdir="${docs.dir}" 
classpath="${project.dir}" 
author="true" version="true" 
use="true" >            
<fileset dir="${project.dir}\src" defaultexcludes="yes">
  <include name="**/*.java"/>
  <exclude name=".externalToolBuilders/**"/>
</fileset>
</javadoc>

我收到了这个错误:

javadocs:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source file D:\Paul\PaulHostIP\src\AutofitTableColumns.java...
[javadoc] javadoc: error - Illegal package name: ".externalToolBuilders.one-jar-ant-task-0.97.ant.com.simontuffs.onejar.ant"
[javadoc] Loading source file D:\Paul\PaulHostIP\src\CToolTip.java...
[javadoc] javadoc: error - Illegal package name: ".externalToolBuilders.one-jar-ant-task-0.97.test.com.simontuffs.onejar.test"
[javadoc] Loading source file D:\Paul\PaulHostIP\src\HostIP.java...
[javadoc] Loading source file D:\Paul\PaulHostIP\src\Run.java...
[javadoc] Loading source file D:\Paul\PaulHostIP\src\TableColumnSynchronizer.java...
[javadoc] Loading source file D:\Paul\PaulHostIP\src\ThreadDoSomething.java...
[javadoc] Loading source file D:\Paul\PaulHostIP\src\Work.java...
[javadoc] Loading source files for package src...
[javadoc] 2 errors

1 个答案:

答案 0 :(得分:1)

你可以这样做:

<javadoc 
    destdir="${docs.dir}" 
    author="true" version="true" 
    use="true" 
    doctitle="Test" >
    <fileset dir="${project.dir}/src" defaultexcludes="yes">
         <include name="**/*.java"/>
         <exclude name=".externalToolBuilders/**"/>
    </fileset>
</javadoc>