gpt4 book ai didi

java - Ant JavaDoc 任务从自定义 taglet 中抛出 `NoClassDefFoundError`,即使该类*在类路径中

转载 作者:行者123 更新时间:2023-11-29 05:14:17 25 4
gpt4 key购买 nike

我在处理 JavaDoc Ant 任务时遇到问题。它为我提供了一个 java.lang.NoClassDefFoundError 类,据我所知,该类肯定在类路径中。根据the documentation ,当类在编译期间存在,但在运行时找不到时,将抛出 NoClassDefFoundError。 (一个 NoClassDefFoundError is not a ClassNotFoundException .)

当我删除类路径项时,它按预期失败(很多包/符号未找到错误)并且它仍然给出相同的 NoClassDefFoundError。为什么无论类是否在类路径上,taglet 都会失败?


具体情况:

它找不到的类叫做 com.github.xbn.io.SimpleDebugable,它在这个 jar 文件中:

  • Jar 文件:C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\z_build\jar_dependencies\xbnjava-0.1.4.2-all.jar

screenshot

JavaDoc Ant 任务。上面的 jar 文件是类路径中的第一项。

<target name="doca" description="Generates javadoc documentation.">
<property name="jar_base_dir" value="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\z_build\jar_dependencies\"/>
<property name="taglet_jar" value="C:\data_jeffy\programming\build\codelet-0.1.4.1\download\codelet-0.1.4.1-all.jar"/>

<javadoc
packagenames="com.github.aliteralmind.codelet,com.github.aliteralmind.codelet.alter,com.github.aliteralmind.codelet.simplesig,com.github.aliteralmind.codelet.taglet,com.github.aliteralmind.codelet.type,com.github.aliteralmind.codelet.util"
defaultexcludes="yes"
destdir="C:\data_jeffy\programming\build\codelet-0.1.4.1\documentation\javadoc"
splitindex="true"
additionalparam="-J-Dcodelet_config_dir=C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\codelet_config\"
classpath="${jar_base_dir}xbnjava-0.1.4.2-all.jar;
C:\data_jeffy\programming\build\codelet-0.1.4.1\download\codelet-0.1.4.1-all.jar;
${jar_base_dir}templatefeather-0.1.1.2-all.jar;
${jar_base_dir}commons-io-2.4.jar;
${jar_base_dir}guava-16.0.1.jar;
${jar_base_dir}jdk_751__tools__contains_com_sun.jar"
>
<sourcepath>
<pathelement path="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src"/>
</sourcepath>
<!-- Custom taglets-->
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletTaglet"
path="${taglet_jar}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletDotOutTaglet"
path="${taglet_jar}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletAndOutTaglet"
path="${taglet_jar}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.FileTextletTaglet"
path="${taglet_jar}"/>
</javadoc>
</target>

结果是:

[javadoc] javadoc: error - In doclet class com.sun.tools.doclets.standard.Standard,
method start has thrown an exception java.lang.reflect.InvocationTargetException
[javadoc] java.lang.NoClassDefFoundError: com/github/xbn/io/SimpleDebuggable

完整输出:

[C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet]ant docx
Buildfile: C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\build.xml

docx:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package com.github.aliteralmind.codelet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.alter...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.simplesig...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.taglet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.type...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.util...
[javadoc] Constructing Javadoc information...
[javadoc] 1 error
[javadoc] javadoc: error - In doclet class com.sun.tools.doclets.standard.Standard, method start has thrown an exception java.lang.reflect.InvocationTargetException
[javadoc] java.lang.NoClassDefFoundError: com/github/xbn/io/SimpleDebuggable
[javadoc] at java.lang.ClassLoader.defineClass1(Native Method)
[javadoc] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[javadoc] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[javadoc] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[javadoc] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.wasLoaded(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.loadConfiguration(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.<clinit>(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.taglet.CodeletTaglet.<clinit>(Unknown Source)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:606)
[javadoc] at com.sun.tools.doclets.internal.toolkit.taglets.TagletManager.addCustomTag(TagletManager.java:219)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.initTagletManager(Configuration.java:466)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.setOptions(Configuration.java:437)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.setOptions(Configuration.java:447)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:120)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:606)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:167)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:59)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:49)
[javadoc] Caused by: java.lang.ClassNotFoundException: com.github.xbn.io.SimpleDebuggable
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[javadoc] ... 37 more

BUILD SUCCESSFUL
Total time: 1 second

当您从类路径中完全删除 jar 文件时,它会按预期失败,并出现数百个 package com.github.xbn.... does not existsymbol not found 错误,这意味着类路径元素显然是“有效的”。那么为什么它不适用于 taglet?

jar 的输出在类路径上:

[C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet]ant docx
Buildfile: C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\build.xml

docx:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package com.github.aliteralmind.codelet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.alter...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.simplesig...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.taglet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.type...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.util...
[javadoc] Constructing Javadoc information...
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:18: error: package com.github.xbn.linefilter.alter does not exist

[javadoc] import com.github.xbn.linefilter.alter.TextLineAlterer;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:19: error: package com.github.xbn.linefilter does not exist
[javadoc] import com.github.xbn.linefilter.FilteredLineIterator;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:20: error: package com.github.xbn.analyze.alter does not exist
[javadoc] import com.github.xbn.analyze.alter.ExpirableElements;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:21: error: package com.github.xbn.analyze.alter does not exist
[javadoc] import com.github.xbn.analyze.alter.MultiAlterType;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:22: error: package com.github.xbn.array does not exist
[javadoc] import com.github.xbn.array.NullElement;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:23: error: package com.github.xbn.lang does not exist
[javadoc] import com.github.xbn.lang.IllegalArgumentStateException;
[javadoc] ^

继续(删除了约 1,500 行):

  [javadoc]     import  com.github.xbn.linefilter.FilteredLineIterator;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\util\zCodeletCustomizers.java:25: error: package com.github.xbn.analyze.alter does notexist
[javadoc] import com.github.xbn.analyze.alter.ExpirableElements;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\util\zCodeletCustomizers.java:26: error: package com.github.xbn.analyze.alter does notexist
[javadoc] import com.github.xbn.analyze.alter.MultiAlterType;
[javadoc] ^
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\util\zCodeletCustomizers.java:27: error: package com.github.xbn.array does not exist
[javadoc] 1 error
[javadoc] import com.github.xbn.array.NullElement;
[javadoc] 371 warnings
[javadoc] ^

继续:在最后,它给出了与类路径中的 jar 时相同的错误:

  [javadoc] javadoc: error - In doclet class com.sun.tools.doclets.standard.Standard,
method start has thrown an exception java.lang.reflect.InvocationTargetException
[javadoc] java.lang.NoClassDefFoundError: com/github/xbn/io/SimpleDebuggable
[javadoc] at java.lang.ClassLoader.defineClass1(Native Method)
[javadoc] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[javadoc] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[javadoc] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[javadoc] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.wasLoaded(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.loadConfiguration(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.CodeletBootstrap.<clinit>(Unknown Source)
[javadoc] at com.github.aliteralmind.codelet.taglet.CodeletTaglet.<clinit>(Unknown Source)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:606)
[javadoc] at com.sun.tools.doclets.internal.toolkit.taglets.TagletManager.addCustomTag(TagletManager.java:219)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.initTagletManager(Configuration.java:466)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.setOptions(Configuration.java:437)
[javadoc] at com.sun.tools.doclets.internal.toolkit.Configuration.setOptions(Configuration.java:447)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:120)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:606)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:167)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:59)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:49)
[javadoc] Caused by: java.lang.ClassNotFoundException: com.github.xbn.io.SimpleDebuggable
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[javadoc] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[javadoc] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[javadoc] ... 37 more

BUILD SUCCESSFUL
Total time: 1 second

在原始(上方)目标中,taglet 的路径指向 jar 文件。对于下面的内容,我将 taglet 类文件从 jar 中提取到一个目录中(仅提取这四个 taglet 类,其他所有内容都保留在 jar 中),并将 taglet 路径更改为根目录。

<property name="jar_base_dir" value="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\z_build\jar_dependencies\"/>
<property name="taglet_base_dir" value="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\bin\com\github\aliteralmind\codelet\taglet"/>
<javadoc
packagenames="com.github.aliteralmind.codelet,com.github.aliteralmind.codelet.alter,com.github.aliteralmind.codelet.simplesig,com.github.aliteralmind.codelet.taglet,com.github.aliteralmind.codelet.type,com.github.aliteralmind.codelet.util"
defaultexcludes="yes"
destdir="C:\data_jeffy\programming\build\codelet-0.1.4.1\documentation\javadoc"
splitindex="true"
additionalparam="-J-Dcodelet_config_dir=${dir_sandbox}${codelet.config.dir}${fs}"
classpath="${jar_base_dir}xbnjava-0.1.4.2-all.jar;
C:\data_jeffy\programming\build\codelet-0.1.4.1\download\codelet-0.1.4.1-all.jar;
${jar_base_dir}templatefeather-0.1.1.2-all.jar;
${jar_base_dir}commons-io-2.4.jar;
${jar_base_dir}guava-16.0.1.jar;
${jar_base_dir}jdk_751__tools__contains_com_sun.jar"
>
<sourcepath>
<pathelement path="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src"/>
</sourcepath>
<!-- Custom taglets-->
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletTaglet"
path="${taglet_base_dir}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletDotOutTaglet"
path="${taglet_base_dir}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletAndOutTaglet"
path="${taglet_base_dir}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.FileTextletTaglet"
path="${taglet_base_dir}"/>
</javadoc>

现在 NoClassDefFoundError 不会发生。相反,它是

javadoc: error - Error - Exception java.lang.ClassNotFoundException
thrown while trying to register Taglet com.github.aliteralmind.codelet.taglet.CodeletTaglet...

现在的问题是,这个错误似乎被JavaDoc“吞噬”了。我不知道如何查看那个 java.lang.ClassNotFoundException 的踪迹。

完整输出:

docb:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package com.github.aliteralmind.codelet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.alter...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.simplesig...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.taglet...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.type...
[javadoc] Loading source files for package com.github.aliteralmind.codelet.util...
[javadoc] Constructing Javadoc information...
[javadoc] javadoc: error - Error - Exception java.lang.ClassNotFoundException
thrown while trying to register Taglet com.github.aliteralmind.codelet.taglet.CodeletTaglet...
[javadoc] javadoc: error - Error - Exception java.lang.ClassNotFoundException
thrown while trying to register Taglet com.github.aliteralmind.codelet.taglet.CodeletDotOutTaglet...
[javadoc] javadoc: error - Error - Exception java.lang.ClassNotFoundException
thrown while trying to register Taglet com.github.aliteralmind.codelet.taglet.CodeletAndOutTaglet...
[javadoc] Standard Doclet version 1.7.0_72
[javadoc] javadoc: error - Error - Exception java.lang.ClassNotFoundException thrown while trying to register Taglet com.github.aliteralmind.codelet.taglet.FileTextletTaglet...
[javadoc] Building tree for all the packages and classes...
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\BasicCustomizers.java:90:
warning - @.codelet is an unknown tag.

...lots of lines deleted...

[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\util\JavaDocUtil.java:185:
warning - @.codelet.and.out is an unknown tag.
[javadoc] C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src\com\github\aliteralmind\codelet\util\JavaDocUtil.java:185:
warning - @.codelet.and.out is an unknown tag.
[javadoc] Building index for all the packages and classes...
[javadoc] Building index for all classes...
[javadoc] Generating C:\data_jeffy\programming\build\codelet-0.1.4.1\documentation\javadoc\help-doc.html...
[javadoc] 4 errors
[javadoc] 57 warnings

BUILD SUCCESSFUL
Total time: 2 seconds

再次详细输出:http://dpaste.com/3T0B40X

最佳答案

问题是标签路径。类路径必须冗余地传递到主要 JavaDoc 任务和每个自定义 taglet 中。每个 taglet 必须具有不同的 ClassLoader,因此需要重复的类路径。

Ant documentation for the taglet's "path" attribute没有明确地说这是一个类路径,这让我感到困惑:

A path specifying the search path for the taglet class (e.g. /home/taglets). The path may also be specified by a nested element

工作目标:

<target name="docc" description="Generates javadoc documentation.">

<property name="jar_base_dir" value="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\z_build\jar_dependencies\"/>
<property name="taglet_base_dir" value="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\bin\"/>
<property name="javadoc_classpath"
value="${jar_base_dir}xbnjava-0.1.4.2-all.jar;C:\data_jeffy\programming\build\codelet-0.1.4.1\download\codelet-0.1.4.1-all.jar;${jar_base_dir}templatefeather-0.1.1.2-all.jar;${jar_base_dir}commons-io-2.4.jar;${jar_base_dir}guava-16.0.1.jar;${jar_base_dir}jdk_751__tools__contains_com_sun.jar;${jar_base_dir}commons-lang3-3.3.2.jar"/>

<javadoc
packagenames="com.github.aliteralmind.codelet,com.github.aliteralmind.codelet.alter,com.github.aliteralmind.codelet.simplesig,com.github.aliteralmind.codelet.taglet,com.github.aliteralmind.codelet.type,com.github.aliteralmind.codelet.util"
defaultexcludes="yes"
destdir="C:\data_jeffy\programming\build\codelet-0.1.4.1\documentation\javadoc"
splitindex="true"
additionalparam="-J-Dcodelet_config_dir=${dir_sandbox}${codelet.config.dir}${fs}"
classpath="${javadoc_classpath}"
>
<sourcepath>
<pathelement path="C:\data_jeffy\programming\sandbox\z__for_git_commit_only\codelet\src"/>
</sourcepath>
<!-- Custom taglets-->
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletDotOutTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletAndOutTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.FileTextletTaglet"
path="${javadoc_classpath}"/>
</javadoc>
</target>

一个更便携的选择:

<target name="docd" description="Generates javadoc documentation.">
<property name="sandbox_grandparent" value="C:/data_jeffy/programming/"/>
<property name="sandbox_parent" value="${sandbox_grandparent}sandbox/z__for_git_commit_only/"/>
<property name="sandbox" value="${sandbox_parent}codelet/"/>

<path id="project_classpath2">
<pathelement location="${sandbox_parent}codelet/bin/"/>
<pathelement location="${sandbox_grandparent}/build/codelet-0.1.4.1/download/codelet-0.1.4.1-all.jar"/>
<fileset dir="${sandbox}z_build/jar_dependencies/" includes="*.jar"/>
</path>
<pathconvert pathsep=";" property="javadoc_classpath" refid="project_classpath2"/>

<javadoc
packagenames="com.github.aliteralmind.codelet.*"
defaultexcludes="yes"
destdir="${sandbox_grandparent}/build/codelet-0.1.4.1/documentation/javadoc"
splitindex="true"
additionalparam="-J-Dcodelet_config_dir=${dir_sandbox}${codelet.config.dir}${fs}"
classpathref="project_classpath2"
>
<sourcepath>
<pathelement path="${sandbox}src"/>
</sourcepath>
<!-- Custom taglets-->
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletDotOutTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.CodeletAndOutTaglet"
path="${javadoc_classpath}"/>
<taglet name="com.github.aliteralmind.codelet.taglet.FileTextletTaglet"
path="${javadoc_classpath}"/>
</javadoc>
</target>

关于java - Ant JavaDoc 任务从自定义 taglet 中抛出 `NoClassDefFoundError`,即使该类*在类路径中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27137850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com