Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After working with about every asset pipeline tool in the Java toolkit for a while I have come to a few conclusions:</p> <h3>Java Based Tooling</h3> <p>There are a handful of tools out there but the most popular are JAWR and Wro4J. The biggest problem with both of these is that they are mostly <a href="https://developer.mozilla.org/en-US/docs/Rhino" rel="nofollow noreferrer">Rhino</a> based (WRO4J now has some Node support) and Rhino is dog slow compared to Node based tools. You also have to consider that the JavaScript tooling is rapidly maturing so you should be looking for tools that can move quickly.</p> <ul> <li><p><a href="https://github.com/wro4j/wro4j" rel="nofollow noreferrer">WRO4J</a> - Support is great, Maven AND Eclipse integration are great the list of plugins is extensive and the framework is flexible enough that with some elbow grease you can write a plugin for whatever you need. If you're confined to a Java based asset pipeline this is for sure the way to go. The issue with Wro4j is that it is slow ( even when it kicks off Node processes ) relative to Node based tools. <br> To give some real world numbers compiling and concatenating 25 asset bundles containing LESS, CSS CoffeeScript and JavaScript takes about ~35s when using Rhino and ~15s using Wro4j's Node support on a 2013 iMac with 16G of RAM. Using <a href="http://gruntjs.com/" rel="nofollow noreferrer">Grunt</a>+Node takes about 2s on my puny MacBook Air.</p></li> <li><p><a href="http://jawr.java.net/" rel="nofollow noreferrer">JAWR</a> - The integrations and feature list are pretty good but the docs aren't great and writing your own plugins can be a little tricky. When I originally wrote this post JAWR was in the middle of a 4 year hiatus but is now back under active development as of Jan 2014. If you choose to investigate Java Tools this is worth investigation.</p></li> </ul> <h3>Node Based Tooling (integrated with Ant/Maven Builds)</h3> <ul> <li><p><a href="http://gruntjs.com/" rel="nofollow noreferrer">Grunt</a> - It's easy, has a fantastic plugin ecosystem and the community is massive. If there is something you need to do you can bet there is a plugin for it - possibly even one written by the creators of grunt. The major criticisms of Grunt are that it is configuration driven which makes for a very setup easy but is not the "Node Way." It's also worth mentioning that Grunt tasks are not easily composable so for a complex JavaScript build pipeline Grunt may not be ideal.</p></li> <li><p><a href="http://gulpjs.com/" rel="nofollow noreferrer">Gulp</a> - Gulp is the fast growing alternative to Grunt. Its concurrent by default and uses streams to avoid temporary writes to the file system which can considerably speed up your build. Gulp is very idiomatic and has an emphasis on code > configuration and while this gives you a lot of power it's is not ideal for teams that don't have a core competency in JavaScript.</p></li> </ul> <p>The only potential hang up for JavaScript based tooling is that you will have to have <a href="http://nodejs.org/" rel="nofollow noreferrer">Node</a>, <a href="https://npmjs.org/" rel="nofollow noreferrer">npm</a> and <a href="https://npmjs.org/package/grunt-cli" rel="nofollow noreferrer">grunt-cli</a>/<a href="https://www.npmjs.org/package/gulp" rel="nofollow noreferrer">gulp</a> on any machine that needs to do the compilation. If you don't have access to your CI machines or are not using artifact based deploys this may be a hard sell. <br> <br> Integrating this into your Maven project is pretty easy and you have quite a few options. You can use the Maven <a href="https://gist.github.com/nadavdav/5308453" rel="nofollow noreferrer">ant-run plugin</a>, you can run an <a href="http://ant.apache.org/manual/Tasks/exec.html" rel="nofollow noreferrer">ant exec task</a> and call it from Maven or best of all you can just use the <a href="http://mojo.codehaus.org/exec-maven-plugin/usage.html" rel="nofollow noreferrer">maven exec task</a>. <br> Below is the code to integrate this into the Maven lifecycle using the exec plugin if this is helpful to anybody.</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.2.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;prepare-package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;exec&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;executable&gt;grunt&lt;/executable&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload