我正在使用Eclipse Indigo和M2E通過WTP部署本地Web應用程序。我也使用yui-compressor插件,它似乎在目標下的爆炸戰爭目錄中工作正常,但不支持eclipse WTP。有沒有推薦的方法來設置這個,所以我可以在本地開發並使用縮小的文件?yui壓縮機maven插件可以使用WTP嗎?
這裏是我的衣配置:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
<force>true</force>
<jswarn>false</jswarn>
<linebreakpos>-1</linebreakpos>
<excludes>
<exclude>**/lib/*</exclude>
</excludes>
<aggregations>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/static/js/script-${timestamp}.min.js</output>
<includes>
<include>**/script/*.js</include>
</includes>
<excludes>
<exclude>**/lib/*</exclude>
</excludes>
</aggregation>
</aggregations>
</configuration>
</plugin>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<versionRange>[1.2,)</versionRange>
<goals>
<goal>compress</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
謝謝,這樣做後,我可以看到資源被放在網絡資源文件夾中並縮小。不過,似乎我無法逐步完成此操作。儘管yui插件可以在任何資源保存後運行,但除非再次執行構建,否則更改不會推送到web資源文件夾。有沒有辦法解決這個問題,所以我可以使用它與WTP? – user842800 2012-04-01 17:51:34