http://www.baeldung.com/maven-minification-of-js-and-css-assetsの指示に従って、Spring MVC WebアプリケーションでYUI圧縮エンジンのMavenプラグインを使用しようとしています。私はsrc/main/webapp
下のサブフォルダには多くのCSSやJSファイルを持っているし、マニュアルに従って、これらすべてが縮小されるべきmavenプラグインを使用したCSSとJSファイルの縮小が動作しない
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
<webappDirectory>${project.build.directory}/min</webappDirectory>
<excludes>
<exclude>**/*.min.js</exclude>
<exclude>**/handlebars-3133af2.js</exclude>
<exclude>**/require.js</exclude>
</excludes>
</configuration>
</plugin>
:私は私のpom.xml
ファイルに以下を追加しました。しかし、私がmaven clean install
を実行すると、私のコンソールでの縮小に関連するログも表示されず、war
ファイルで縮小されたファイルが見つかりません。
私が欲しいのは、既存のCSSやJSファイルと同じフォルダ内に同じファイル名でmin
という名前のサブフォルダの下に縮小さ、ファイルを保存することです
コンソールログは以下のようになります。
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building smartwcm-services 6.3.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ smartwcm-services ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 36 resources
[INFO]
[INFO] --- yuicompressor-maven-plugin:1.5.1:compress (default) @ smartwcm-services ---
[ERROR] E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js [1:2]: illegal character
[ERROR] ...E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js:line 1:column 2:illegal character
/* Note: jquery script is assumed to be loaded prior to this script */
[ERROR] E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js [1:2]: syntax error
[ERROR] ...E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js:line 1:column 2:syntax error
/* Note: jquery script is assumed to be loaded prior to this script */
[ERROR] E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js [1:3]: illegal character
[ERROR] ...E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js:line 1:column 3:illegal character
/* Note: jquery script is assumed to be loaded prior to this script */
[ERROR] E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js [1:0]: Compilation produced 3 syntax errors.
[ERROR] ...E:\projects\smartwcm\source-code\smartwcm-services\src\main\webapp\layout\common\adminv3\ca\css\content\design\azure.js:line 1:column 0:Compilation produced 3 syntax errors.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.060 s
[INFO] Finished at: 2016-12-29T11:25:32+05:30
[INFO] Final Memory: 19M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.5.1:compress (default) on project smartwcm-services: Execution default of goal net.alchim31.maven:yuicompressor-maven-plugin:1.5.1:compress failed: Compilation produced 3 syntax errors. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
現在の設定でログに何も表示されない –
mvnコンソールログを投稿できますか?同じgithubプロジェクトのビルドを実行していますか? – abaghel
ログと更新されたpom.xmlファイルで質問を更新しました –