Maven Javascript Plugin

Javascript has been considered for long time to be a hack language for web pages, with lack of object orientation and too lazy syntax. Recent explosion of ajax "web 2.0" rich internet application demonstrates that javascript is a mature platform, with powerfull libraries and talentuous developers.

Java development has tools like Ant and Maven to handle project lifecycle and integrate build, documentation and reporting tools. Javascript also has various tools, but no real consensus on how to manage a javascript project. In particular, javascript development as part of a JEE web application should integrate well with exiting java tools.

Maven javascript plugin aims to provide a project lifecycle similar to the one used by java projects, and to integrate with java war projects.

Goals Overview

For web application developers :

  • javascript:copy-dependencies handles javascript dependencies and unpack them to your script directory.
  • javascript:compile prepares your scripts to get packaged in the web application.
  • javascript:inplace unpack javascript dependencies to your web application source, to enable quick development with servlet containers that don't require a packaging phase.
  • javascript:compress use a configurable javascript compressor to reduce the weight of js files.

    For javascripts library developers :

  • javascript:jsar pack a maven based javascript library as a javascript archive to get installed/deployed in the repository.
  • javascript:attach-compressed pack a javascript archive with compressed version of the library scripts.


Instructions on how to use the Maven Javascript Plugin can be found here.


To provide you with better understanding of some usages of the Plugin Name, you can take a look into the following examples: