Javadoc排除导致导入错误

Rya*_*Bis 10 java javadoc gradle

我正在调整我公司生产的库的javadocs.我们希望将javadocs排除在那些并非真正用于公共消费的类中(主要是内部使用的类).

该项目使用gradle作为构建系统,我已经在build.gradle文件中标记了要排除的包/类.但是,这会导致错误发生.我希望得到一个警告,或者如果有一个排除的类的@link,则会出现错误,但是当简单地导入这些排除的类时,它也会抛出错误.有没有办法"包含"类/包,但不为它们导出javadoc?

编辑:这是相关的javadoc任务:

task gendocs(type: Javadoc) {
    options.stylesheetFile = new File("./assets/doc_style.css")
    String v = "${SEMVER}"
    version = v.replace("_", '.')
    title = "SweetBlue ${version} API"
    options.windowTitle = "SweetBlue"
    options.memberLevel = JavadocMemberLevel.PROTECTED
    options.author = true
    options.linksOffline('http://d.android.com/reference', System.getenv("ANDROID_HOME") + '/docs/reference')    
    destinationDir = new File("${BUNDLE_FOLDER}/docs/api")
    source = sourceSets.main.allJava
    classpath += configurations.compile
    exclude "com/idevicesinc/sweetblue/backend"
    exclude "com/idevicesinc/sweetblue/utils/Utils**.java"
    exclude "com/idevicesinc/sweetblue/utils/UpdateLoop.java"
    exclude "com/idevicesinc/sweetblue/utils/Pointer.java"
    exclude "com/idevicesinc/sweetblue/utils/HistoricalDataQuery.java"
}
Run Code Online (Sandbox Code Playgroud)

编辑2:这是我正在谈论的错误:

SweetBlue/src/com/idevicesinc/sweetblue/BleCharacteristic.java:5: error: cannot find symbol
import com.idevicesinc.sweetblue.utils.Utils;                                      
symbol:   class Utils
location: package com.idevicesinc.sweetblue.utils
Run Code Online (Sandbox Code Playgroud)

编辑3:

似乎在gradle javadoc任务中排除与在javadoc命令行上使用-exclude不同.我使用CLI javadoc生成运行测试,并且我没有得到使用Gradle时发现的未找到的错误.

Ste*_*ann 3

Javadoc 需要了解导入的类。使用类路径告诉 javadoc 在哪里可以找到类文件而不是 java 源代码!

我对 XJC 生成的代码也有同样的问题,该代码在 ant 环境中生成大量 javadoc 错误。为了将它们从文档中排除但仍然满足 javadoc 我只是告诉 javadoc 任务查看 bin 文件夹:

<target name="javadoc" description="create Javadoc documentation">
    <javadoc ...lots of irrelevant attributes skipped...>
        <fileset dir="src">
            <include name="**/*.java"/>
            <exclude name="my/jaxb/generated/source/*.java"/>
        </fileset>
        <classpath>
            <path refid="myclasspath_to_referenced_libraries"/>
            <pathelement location="bin"/>
        </classpath>
    </javadoc>
</target>
Run Code Online (Sandbox Code Playgroud)