Why use Maven for Javascript ?

Maven's goals around software project management and comprehension can benefit JavaScript projects. Some of the benefits that can be readily attained are: project versioning, automated testing; continuous integration; dependency management; packaging; and release management.

Javascript developers have created nice toolkits like QUnit and JsDocs to get a productive and controlled development environment. They also use libraries like jQuery for development, split code into fine grained scripts and use some assembly tools to create the released scripts.

The Javascript Maven Tools project brings together tools from many places and greatly reduces the burden on you to develop your Javascript library or application.

Project Definition

Your project configures one extension in a minimal pom file to enable javascript support:

<?xml version="1.0" encoding="UTF-8"?>
  <groupId>your groupid</groupId>
  <artifactId>your artifact id</artifactId>
  <version>your version</version>
  <name>Some name</name>
  <description>A really nice description</description>




Maven Javascript Tools and associated plugins use the following conventions for directory structure. Conforming with this layout will keep your POM files as simple as possible.

  +- pom.xml
  +- src/
  |  |
  |  +- main/
  |  |  |
  |  |  +- js/ (source location for Scripts)
  |  |  +- resources/ (source location for any static resources)
  |  |
  |  +- test/
  |  |  |
  |  |  +- js/ (source location for test scripts)
  |  |  +- resources/ (source location for test resources)
  |  |

Once you have your pom file and associated files then you can load your application into a web browser via http://localhost:8080/ using the following command:

mvn jetty:run

Where to next

We recommend that you start with some of the provided template projects (archetypes) and then come back to this documentation.

A quick note on tooling for Eclipse IDE users. We are looking to support the m2e integration of Maven with Eclipse. However at the time of writing we recommend that you use the Eclipse plugin until we get the tooling right.