I want to know how one can compress javascriptfiles using maven. I have lready visited webistes like http://mojohaus.org/javascript-maven-tools/guide-webapp-development.html but there is no implementation explained.
I want to know the dependency for executing the maven plugin.
Я предлагаю использовать YUI Compressor Maven Mojo и его yuicompressor:compress
цель вместо этого. Он хорошо документирован, он просто работает.
Чтобы использовать его, добавьте следующий pluginRepository
:
<pluginRepositories>
<pluginRepository>
<name>oss.sonatype.org - github-releases</name>
<id>oss.sonatype.org-github-releases</id>
<url>http://oss.sonatype.org/content/repositories/github-releases</url>
</pluginRepository>
</pluginRepositories>
И объявите плагин:
<project>
...
<build>
<!-- To define the plugin version in your parent POM -->
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>0.9</version>
</plugin>
...
</plugins>
</pluginManagement>
<!-- To use the plugin goals in your POM or parent POM -->
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
См. страницу Usage и параметры yuicompressor:compress для точной конфигурации.