Sonntag, 9. Juni 2013

CoffeeScript compilation in Maven project

There are three available Maven plugins:
Brew works and has a lot of features, but unfortunately it is not supported yet.
Coffescript-maven-plugin works only with Java version 7, what in our case is not applicable.
Coffee-maven-plugin by talios has been recently updated und works fine with Maven 3 and Java 6.
Lets look, how to activate Coffescript compilation in our project:
      <plugin>
        <groupId>com.theoryinpractise</groupId>
        <artifactId>coffee-maven-plugin</artifactId>
        <version>1.4.7</version>
        <configuration>
          <coffeeDir>${basedir}/src/main/webapp/js/coffee</coffeeDir>
          <coffeeOutputDirectory>${basedir}/src/main/webapp/js</coffeeOutputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>coffee</id>
            <goals>
              <goal>coffee</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

To run it we need to execute next command:
$ mvn coffee:coffee
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building tweet-ninja 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- coffee-maven-plugin:1.4.7:coffee (default-cli) @ test-app ---
[INFO] Compiling JoinSet: test with files:  test.coffee, 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.138s
[INFO] Finished at: Sun Jun 09 13:09:46 CEST 2013
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------

Keine Kommentare:

Kommentar veröffentlichen