0
下面是行家pom.xml
建立會話的YUICompressor - Maven的插件不工作安裝或稱爲相
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>${project.artifactId}</warName>
<warSourceExcludes>**/*.js,**/*.css</warSourceExcludes>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<jswarn>false</jswarn>
<nosuffix>true</nosuffix>
<linebreakpos>-1</linebreakpos>
<excludes>
<exclude>**/*.min.js</exclude>
<exclude>**/*.min.css</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
和運行時mvn install
或mvn pre-package
(這是指定期)沒有的YUICompressor-maven-插件工作日誌。
$mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gif-www 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gif-www ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gif-www ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gif-www ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ximing/work/gifmiao/gif-www/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ gif-www ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ gif-www ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ gif-www ---
[INFO] Packaging webapp
[INFO] Assembling webapp [gif-www] in [/home/ximing/work/gifmiao/gif-www/target/gif-www-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ximing/work/gifmiao/gif-www/src/main/webapp]
[INFO] Webapp assembled in [170 msecs]
[INFO] Building war: /home/ximing/work/gifmiao/gif-www/target/gif-www.war
[INFO] WEB-INF/web.xml already added, skipping
但使用mvn yuicompressor:compress
可以得到的YUICompressor日誌顯示插件工作。
我也不知道如何將壓縮後的css和js打包到war文件(使用相同的文件名,因爲我不想調整html模板中的include代碼)。一直在這一整天工作,有人給我一個線索?