简体   繁体   中英

yuicompressor-maven-plugin not working at mvn install or designated phase

Here is the maven pom.xml build session

<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>

and when run mvn install or mvn pre-package (which is the designated phase ) there is no yuicompressor-maven-plugin working log.

$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

but using mvn yuicompressor:compress can get the yuicompressor log shows that the plugin is working.

and I also don't know how to package the compressed css and js to the war file (with the same file name cause I don't want to tweak the include code in html template). Have been working on this about a whole day, someone give me a clue?

You are only defining, but not executing your plugin by putting the configuration between the tag.

See also https://stackoverflow.com/a/10483284/1110843

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM