我只想在将项目打包成war文件时压缩文件。我是Maven的新手,这是我尝试使用的第一个包装插件。
我按照http://alchim.sourceforge.net/yuicompressor-maven-plugin/plugin-info.html的说明和其他一些关于此插件的问题:
我的构建部分只有基础知识:
<build>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
(...)
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
(...)
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
</configuration>
</plugin>
</plugins>
</build>
但是,当我尝试打包战时:战争&#39;它没有压缩任何东西:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FCO-novo-layout 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ FCO-novo-layout ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ FCO-novo-layout ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ FCO-novo-layout ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ FCO-novo-layout ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ FCO-novo-layout ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ FCO-novo-layout ---
[INFO] Packaging webapp
[INFO] Assembling webapp [FCO-novo-layout] in [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\WebContent]
[INFO] Webapp assembled in [379 msecs]
[INFO] Building war: C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT.war
[INFO]
##########################################################################
##########################################################################
[INFO] --- yuicompressor-maven-plugin:1.1:compress (default) @ FCO-novo-layout ---
[INFO] nb warnings: 0, nb errors: 0
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-cli) @ FCO-novo-layout ---
[INFO] Packaging webapp
[INFO] Assembling webapp [FCO-novo-layout] in [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\WebContent]
[INFO] Webapp assembled in [969 msecs]
[INFO] Building war: C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.472 s
[INFO] Finished at: 2016-08-11T11:53:58-03:00
[INFO] Final Memory: 15M/217M
[INFO] ------------------------------------------------------------------------
答案 0 :(得分:1)
在你的maven pom目录上运行 mvn net.alchim31.maven:yuicompressor-maven-plugin:compress 怎么样?