使用 Maven Javadoc 插件生成多个 TLD顶级域名生成器

发布于 2024-10-06 05:08:22 字数 1634 浏览 3 评论 0原文

我有一个 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 中带有两个报告集的报告部分,看看是否有帮助,但没有运气。

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

I've got a taglib project that I use the TLDGen library to help build my TLD files from annotations in my classes. I've then got it plugged into the Maven JavaDoc plugin to have it build the TLD files via the javadoc:javadoc Maven goal. Pom portion that handles this is as follows:

<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>

And this works fantastically. Trouble is that I know want to create 2 TLD's from this project. I can pass a -subpackages attribute in th addtionalparam element so I can produce a TLD with exactly what I want.

But I can only have one configuration element at that point. I've tried moving the configuration into the reporting section in my pom with two reportsets to see if that helps but no luck.

Has anyone ever attempted this before and can help point me in the right direction for getting it right? Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿嘿嘿 2024-10-13 05:08:22

这个问题发布已经有一段时间了,但以下是我如何使用 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>

It's been a while since this question was posted, but here's how I did multiple tld generation with TLDGen. I started from your question, since the guys over at the project used your answer as a reference :).

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文