1

我有一个 taglib 项目,我使用TLDGen库来帮助从我的类中的注释构建我的 TLD 文件。然后我将它插入 Maven JavaDoc 插件,让它通过 javadoc:javadoc Maven 目标构建 TLD 文件。处理此问题的 Pom 部分如下:

<build>
    ...
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <doclet>org.tldgen.TldDoclet</doclet>
                <docletArtifact>
                    <groupId>com.google.code.tldgen</groupId>
                    <artifactId>tldgen-all</artifactId>
                    <version>1.0.0</version>
                </docletArtifact>
                <show>private</show>
                <additionalparam>-name test
                    -uri "http://www.mycompany.com/tags/wibble"
                    -tldFile ..\..\..\src\main\resources\META-INF\w.tld
                </additionalparam>
                <useStandardDocletOptions>true</useStandardDocletOptions>
                <author>false</author>
                <encoding>utf-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

这非常有效。问题是我知道想从这个项目中创建 2 个 TLD。我可以在 addtionalparam 元素中传递一个 -subpackages 属性,这样我就可以生成一个完全符合我想要的 TLD。

但那时我只能有一个配置元素。我尝试使用两个报告集将配置移动到我的 pom 中的报告部分,看看是否有帮助,但没有运气。

有没有人曾经尝试过这个并且可以帮助我指出正确的方向以使其正确?干杯!

4

1 回答 1

0

自从发布此问题以来已经有一段时间了,但这是我使用 TLDGen 生成多个 tld 的方式。我从你的问题开始,因为项目中的人用你的答案作为参考:)。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <includes>
            <include>**</include>
        </includes>
        <doclet>org.tldgen.TldDoclet</doclet>
        <docletArtifacts>
            <!-- listing all dependencies for tldgen: 
            the tldgen library, commons-logging, commons-io, 
            commons-lang, geronimo-jsp_2.1_spec, log4j, saxon, stax
            not sure if they have to be listed here, will have to check; if I
            don't set them I get class not found errors, but I'm guessing I 
            have a misconfiguration -->
        </docletArtifacts>
        <show>private</show>
        <additionalparam>
            -htmlFolder ${basedir}/target/docs
            -tldFolder ${basedir}/src/main/java/META-INF
            -license NONE
        </additionalparam>
        <useStandardDocletOptions>true</useStandardDocletOptions>
        <author>false</author>
        <encoding>utf-8</encoding>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jsr173_api</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <phase>generate-resources</phase>                            
            <goals>
                <goal>javadoc</goal>
            </goals>
        </execution>
    </executions>
</plugin>
于 2011-06-20T14:57:15.143 回答