Search code examples
javascriptmaven-2web-frameworks

add javascript dependencies like java dependencies in maven 2?


I'm using apache maven for build project, so i want to add my dependency javascript frameworks automatically based their version , organizing javascript frameworks , and download only modifiying label version . Exist some plugin similar like java dependencies or alternative with maven ?


Solution

  • There is standard way of doing this using a feature of the servlet api version 3. Any jar can expose web resources (javascripts, css, images, etc.) that are located under META-INF/resources.

    To solve your problem I would create a maven project of type "jar" for every javascript framework that you want to re-use in your webapp projects.

    The only caveat is that the servlet-api v3 requires Tomcat 7, which in turn requires Java 6, but this is usually not a problem.

    See this blog: http://alexismp.wordpress.com/2010/04/28/web-inflib-jarmeta-infresources/

    Servlet api 3 reference: http://download.oracle.com/otndocs/jcp/servlet-3.0-fr-eval-oth-JSpec/