2010-12-02 68 views
1

我有一個taglib項目,我使用TLDGen庫來幫助在我的課程中從註釋構建我的TLD文件。然後我將它插入到Maven JavaDoc插件中,通過javadoc:javadoc Maven目標構建TLD文件。處理此問題的POM部分如下所示:使用Maven Javadoc插件和TLDGen生成多個TLD

<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中的報告部分,並添加了兩個報告集,以查看是否有幫助,但沒有運氣。

有沒有人曾經嘗試過,並可以幫助指向正確的方向,讓它正確嗎?乾杯!

回答

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>