如何让 Ant Javadoc 类排除两个文件? [英] How can I make an Ant Javadoc class exclude two files?
问题描述
我正在记录一些 Java 网络服务和支持的数据类型.有两个服务我不想记录.从 Ant javadoc 任务中排除少量文件的正确方法是什么?
I am documenting some Java webservices and the supporting datatypes. There are two services that I do not want documented. What is the correct way to exclude a small number of files from the Ant javadoc task?
我已经尝试使用嵌套在源路径或源文件下的文件或文件集进行多次迭代,其中包含和排除的各种组合.
I have tried several iterations using files or filesets nested under sourcepath or sourcefiles with various combinations of include and exclude.
我正确定义的基本目标记录了我的所有网络服务:
The base target I have defined correctly documents all of my webservices:
<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 © 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>
我尝试过的一些变体包括:
Some variations I have tried include:
<sourcefiles>
<fileset dir="companyproject-ejb/src/java">
<include name="**/*.java"/>
<exclude name="**/*IntegrationTestWS*, **/*NhinInterfaceWS*"/>
</fileset>
</sourcefiles>
此错误与javadoc.exe CreateProcess error=87, 参数不正确
<sourcepath>
<fileset dir="companyproject-ejb/src/java">
<include name="**/*.java"/>
<exclude name="**/*IntegrationTestWS*, **/*NhinInterfaceWS*"/>
</fileset>
</sourcepath>
与源文件相同的错误,但有很多消息说 skiping
.
Same error as sourcefiles, but has a lot of messages saying skipping <somefile> since it is no directory
.
我尝试过使用
而不是
的类似变体.
I have tried similar variations using <files>
instead of <fileset>
.
我想我缺少对包含/排除如何工作的一些基本了解.感谢您的帮助!
I think I am missing some basic understanding of how includes/excludes works. Thank you for your help!
AlexR 不太明白,但接近了.我删除了
并添加了
AlexR didn't quite get it but came close. I removed <sourcepath>
and added
<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>
只有一个文件集导致 javadoc 抱怨它找不到任何包.Packageset 的行为类似于 dirset,因此它不能排除单个文件,只能排除目录.在这种情况下,我能够为一组 doco 定义一个包集,为受限集定义一个文件集并绕过它.
Having only a fileset led javadoc to complain that it couldn't find any packages. Packageset behaves like a dirset, so it can't exclude single files, only directories. In this case I was able to define a packageset for one set of doco and a fileset for the restricted set and get around it.
推荐答案
<fileset dir="src" defaultexcludes="yes">
<include name="com/dummy/test/**"/>
<exclude name="com/dummy/test/doc-files/**"/>
</fileset>
.................
..................
我认为你的错误是sourcefiles"和sourcepath"标签.尝试删除它们.有关更多信息,请查看此处:http://ant.apache.org/manual/Tasks/javadoc.html
I think that your mistake is the "sourcefiles" and "sourcepath" tags. Try to remove them. For more information take a look here: http://ant.apache.org/manual/Tasks/javadoc.html
祝你好运!
这篇关于如何让 Ant Javadoc 类排除两个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!