2013-07-10 58 views
0

我試圖用跑的docbook Maven的jdocbook-插件與Maven 3Maven的jdocbook-plugin的座標和相關

隨着最低配置:

<plugin> 
    <groupId>org.jboss.maven.plugins</groupId> 
    <artifactId>maven-jdocbook-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>default-cli</id> 
     <goals> 
     <goal>generate</goal> 
     </goals> 
     <phase>compile</phase> 
    </execution> 
    </executions> 
    <configuration> 
    <sourceDirectory>src/main/doc/xml</sourceDirectory> 
    <sourceDocumentName>DocBook.xml</sourceDocumentName> 
    <formats> 
     <format> 
     <formatName>html</formatName> 
     <finalName>index.html</finalName> 
     </format> 
    </configuration> 
    </plugin> 

我得到以下錯誤:

[ERROR] Failed to execute goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.8:generate (default-cli) on project <project>: Execution default-cli of goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.8:generate failed: could not locate resource [/html/chunk.xsl] -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.8:generate (default-cli) on project <project>: Execution default-cli of goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.8:generate failed: could not locate resource [/html/chunk.xsl] 

當我看着我的本地倉庫我看到:

$ ls ~/.m2/repository/net/sf/docbook/docbook-xsl 
$ 1.76.1 
$ ls ~/.m2/repository/net/sf/docbook/docbook-xsl/1.76.1 
$ _maven.repositories  docbook-xsl-1.76.1.pom  docbook-xsl-1.76.1.pom.sha1 

所以有一個聚甲醛,但沒有圖書館。

如果我給出的DocBook-XSL的顯式依賴,它的下載內容(但我仍然得到同樣的錯誤):

<dependency> 
    <groupId>net.sf.docbook</groupId> 
    <artifactId>docbook-xsl</artifactId> 
    <version>1.76.1</version> 
    <classifier>ns-resources</classifier> 
    <type>zip</type> 
</dependency> 

我得到它實際產生任何的唯一辦法是給它的docbook版本,XSL其中有一個罐子沒有拉鍊的:

<groupId>net.sf.docbook</groupId> 
<artifactId>docbook-xsl-ns</artifactId> 
<version>1.74.0</version> 

我如何獲得的XSL模板的壓縮版本,這個插件的工作?

回答

0

這是我自己的解決問題的辦法:

DocBook的,XSL庫jar包(1.74.0),它運行時,會自動包含在Maven的jdocbook-插件的類路徑。

帶有zip包裝的版本(1.76.1)不是,需要手動解壓縮。我用這個maven的依賴性 - 插件:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-dependency-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>unpack-docbook-xsl</id> 
    <phase>generate-resources</phase> 
    <goals> 
    <goal>unpack</goal> 
     </goals> 
     <configuration> 
     <artifactItems> 
      <artifactItem> 
      <groupId>net.sf.docbook</groupId> 
      <artifactId>docbook-xsl</artifactId> 
      <version>1.76.1</version> 
      <type>zip</type> 
      <classifier>ns-resources</classifier> 
      <overWrite>true</overWrite> 
      <outputDirectory>${project.build.directory}</outputDirectory> 
      </artifactItem> 
     </artifactItems> 
     </configuration> 
    </execution> 
    </executions> 
</plugin> 

然後我指出了Maven的jdocbook-插件在這個包的樣式表:

<formats> 
    <format> 
    <formatName>html</formatName> 
    <stylesheetResource>file:${project.build.directory}/docbook/html/chunk.xsl</stylesheetResource> 
    <finalName>index.html</finalName> 
    </format> 
    <format> 
    <formatName>pdf</formatName> 
    <stylesheetResource>file:${project.build.directory}/docbook/fo/docbook.xsl</stylesheetResource> 
    <finalName>${project.artifactId}-${project.version}.pdf</finalName> 
    </format> 
    <format> 
    <formatName>html_single</formatName> 
    <stylesheetResource>file:${project.build.directory}/docbook/html/docbook.xsl</stylesheetResource> 
    <finalName>index.html</finalName> 
    </format> 
</formats> 

我歡迎任何短期建議削減這個過程。

1

正如你指出你自己,把式拉鍊的依賴性:

<dependencies> 
    <dependency> 
    <groupId>net.sf.docbook</groupId> 
    <artifactId>docbook-xsl</artifactId> 
    <version>1.76.1</version> 
    <classifier>ns-resources</classifier> 
    <type>zip</type> 
    </dependency> 
</dependencies> 

所有您需要在此之上做的是使用合適的classpath:/ URI配置Maven的jdocbook-插件中的<stylesheetResource>

<format> 
    <formatName>html</formatName> 
    <stylesheetResource>classpath:/docbook/html/chunk.xsl</stylesheetResource> 
</format>