我們使用wro4j maven插件來處理css。我們有這麼多的css,並且在構建時的Wro處理幾乎需要10〜20分鐘。wro4j-maven-plugin性能低下
如果我使用maven並行選項,它會減少到8分鐘。
我仍然想盡可能減少構建時間。
有沒有更好的方法來處理只有已更改的文件。
我的樣本pom.xml文件是
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.6.3</version>
<executions>
<execution>
<id>manage-assets</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration> <targetGroups>myapp${minifier.suffix},myapp.head${minifier.suffix},myapp.tail${minifier.suffix},myapp.compfurniture.head${minifier.suffix},myapp.compfurniture.tail${minifier.suffix},myapp.compfurniture${minifier.suffix},myapp.compfurniture.oldie${minifier.suffix},myapp.oldie${minifier.suffix},myapp.public${minifier.suffix}</targetGroups>
<minimize>true</minimize>
<ignoreMissingResources>false</ignoreMissingResources>
<contextFolder>${assets.folder.aggregate}</contextFolder> <destinationFolder>${assets.folder.aggregate}</destinationFolder> <cssDestinationFolder>${assets.folder.aggregate}/css</cssDestinationFolder> <jsDestinationFolder>${assets.folder.aggregate}/js</jsDestinationFolder>
<wroFile>${project.build.directory}/wro4j/wro.xml</wroFile>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<extraConfigFile>${project.build.directory}/wro4j/wro.properties</extraConfigFile> <groupNameMappingFile>${project.build.directory}/wro4j/wro-namingstrategy.properties</groupNameMappingFile>
</configuration>
</execution>
</executions>
</plugin>
wro4j.properties
preProcessors=cssImport,semicolonAppender
postProcessors=lessCss,cssMinJawr,jsMin
parallelPreprocessing=true
如果某些人試圖這讓我知道。
謝謝你的回覆。如果我將其更改爲最新版本,是否會有任何結果? – Patan
發佈說明中介紹了最新版本的所有更改:https://code.google.com/p/wro4j/wiki/ReleaseNotes 即使您要升級到最新版本,也不會修復性能問題因爲你使用的是慢速處理器。但是,還有一個技巧:將以下配置屬性添加到wro.properties中:parallelPreprocessing = true(默認爲false)。此功能是實驗性的,所以如果您發現任何問題 - 請告訴我。你還可以發佈你的wro.properties文件的內容嗎? –
謝謝你的回答。 – Patan