2017-04-19 45 views
0

我將一個現有的docbook項目從ANT(使用dopus框架)轉移到docbkx-maven-plugin。經過一些麻煩,我得到了正確的輸出,但是性能非常緩慢。處理採用ANT 24秒。使用Maven插件需要6分鐘以上。docbkx-maven-plugin非常慢

的處理似乎停止在:

[INFO] Processing input file: manual.xml 
[DEBUG] Xerces XInclude mode entered 
[DEBUG] User Customization provided: ...doc\src\main\custom-cfg\fo.xsl 
[DEBUG] User Customization provided: ...doc\src\main\custom-cfg\fo.xsl 
[DEBUG] User Customization provided: ...doc\src\main\custom-cfg\fo.xsl 
[DEBUG] Configure the transformer. 
[INFO] Applying customization parameters after docbkx parameters 

之後,沒有輸出約2 - 3分鐘每目標(我有2個進球,爲的JavaHelp和PDF)。如果我停用xincludeSupported,它運行速度非常快,但顯然輸出是無用的。

任何幫助加快構建過程,將不勝感激。

這裏是在POM文件中的配置部分:

<configuration> 
     <sourceDirectory>src/main/docbook</sourceDirectory> 
     <foCustomization>src/main/custom-cfg/fo.xsl</foCustomization> 
     <includes>manual.xml</includes> 
     <xincludeSupported>true</xincludeSupported> 
     <chapterAutolabel>true</chapterAutolabel> 
     <sectionAutolabel>true</sectionAutolabel> 
     <sectionAutolabelMaxDepth>5</sectionAutolabelMaxDepth> 
     <sectionLabelIncludesComponentLabel>true</sectionLabelIncludesComponentLabel> 

     <preProcess> 
     <copy todir="${project.build.directory}/docbkx/javahelp/resource"> 
      <fileset dir="src/main/docbook/resource/"/> 
     </copy> 
     </preProcess> 
    </configuration> 
+1

確保您有足夠的內存分配給maven進程。例如'MAVEN_OPTS = -Xmx1024m -XX:MaxPermSize = 128m'。 –

+0

謝謝,這不是原因。看到我的答案在下面... –

回答

0

一些研究,我找到了原因後。在XML文件中定義的文檔類型:

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 
      "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" 
    [ 
    <!ENTITY % entities SYSTEM "../custom-cfg/local-entities.xml"> 
    %entities; 
    ] 
> 

構建試圖下載DTD中的每個文件,網絡流量造成緩慢的構建。通過添加

  <dependency> 
       <groupId>docbook</groupId> 
       <artifactId>docbook-xml</artifactId> 
       <version>4.5</version> 
       <scope>runtime</scope> 
      </dependency> 

我的docbkx-maven-plugin依賴關係我可以解決這個問題。 (這種依賴關係對於不同的docbook版本是不同的,因爲這裏還有一個必要的存儲庫條目,如下所述:http://docbkx-tools.sourceforge.net/docbkx-samples/manual.html#d5e28