如何让Ant Javadoc类排除两个文件?

Fre*_*eit 9 java ant javadoc

我正在记录一些Java Web服务和支持数据类型.我不想记录两种服务.从Ant javadoc任务中排除少量文件的正确方法是什么?

我已尝试使用嵌套在sourcepath或sourcefiles下的文件或文件集进行多次迭代,并使用include和exclude的各种组合.

我已正确定义的基本目标记录了我的所有Web服务:

    <target name="javadoc.webservices" description="Generate the documentation for companyproject webservices">
    <delete dir="docs/webservices" failonerror="true"/>
    <mkdir dir="docs/webservices"/>
    <javadoc packagenames="com.company.project.webservices,com.company.project.models.*"
             defaultexcludes="yes"
             destdir="docs/webservices"
             author="true"
             version="true"
             use="true"
             windowtitle="company project Webservices">
        <doctitle><![CDATA[<h1>company project Webservices</h1>]]></doctitle>
        <bottom><![CDATA[<i>Copyright &#169; 2011 company Corp. All Rights Reserved.</i>]]></bottom>
        <sourcepath>
            <path location="companyproject-ejb/src/java"/>
            <path location="companyproject-models/src"/>
        </sourcepath>
        <classpath>
            <path refid="companyproject-models.module.classpath"/>
            <path refid="companyproject-ejb.module.classpath"/>
            <pathelement location="${companyproject-ejb.output.dir}"/>
        </classpath>
    </javadoc>
</target>
Run Code Online (Sandbox Code Playgroud)

我尝试过的一些变化包括:

<sourcefiles>
            <fileset dir="companyproject-ejb/src/java">
                <include name="**/*.java"/>
                <exclude name="**/*IntegrationTestWS*, **/*NhinInterfaceWS*"/>
            </fileset>
        </sourcefiles>
Run Code Online (Sandbox Code Playgroud)

这个错误 javadoc.exe CreateProcess error=87, The parameter is incorrect

<sourcepath>
            <fileset dir="companyproject-ejb/src/java">
                <include name="**/*.java"/>
                <exclude name="**/*IntegrationTestWS*, **/*NhinInterfaceWS*"/>
            </fileset>
        </sourcepath>
Run Code Online (Sandbox Code Playgroud)

与sourcefiles相同的错误,但有很多消息说skipping <somefile> since it is no directory.

我尝试使用<files>代替的类似变体<fileset>.

我想我错过了一些关于如何包含/排除作品的基本理解.谢谢您的帮助!

AlexR并没有得到它,但接近了.我删除<sourcepath>并添加

<fileset dir="./Companyproject-ejb/src/java/">
<include name="com/Company/project/webservices/*"/>
<exclude name="**/IntegrationTestWS*"/>
<exclude name="**/NhinInterfaceWS*"/>
</fileset>
<packageset dir="./Companyproject-models/src/">
    <include name="com/Company/project/models/**"/>
</packageset>
Run Code Online (Sandbox Code Playgroud)

只有一个文件集导致javadoc抱怨它找不到任何包.Packageset的行为类似于dirset,因此它不能排除单个文件,只能排除目录.在这种情况下,我能够为一组doco定义一个包集,并为限制集定义一个文件集并绕过它.

Ale*_*exR 6

<fileset dir="src" defaultexcludes="yes">
  <include name="com/dummy/test/**"/>
  <exclude name="com/dummy/test/doc-files/**"/>
</fileset>
Run Code Online (Sandbox Code Playgroud)

..................

我认为你的错误是"sourcefiles"和"sourcepath"标签.尝试删除它们.有关详细信息,请查看此处:http://ant.apache.org/manual/Tasks/javadoc.html

祝好运!

  • 谢谢.我整个早上一直盯着蚂蚁手册!我在哪里放置文件集标签?作为javadoc的孩子?什么是sourcefiles,sourcepath和classpath之间的区别? (2认同)
  • 呃。RTFM,我看到文件集是 javadoc 的嵌套参数。我会试试的。 (2认同)