开发者

Generating Multiple TLDs With Maven Javadoc Plugin & TLDGen

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 attem开发者_开发知识库pted this before and can help point me in the right direction for getting it right? Cheers!


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜