add javascript dependencies like java dependencies in maven 2?
Asked Answered
C

2

7

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 ?

Conation answered 21/5, 2013 at 21:31 Comment(0)
T
12

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/

Taub answered 23/5, 2013 at 13:1 Comment(1)
Thanks for comment, so another alternative i found , using yeoman and bower get all dependencies, i'm doing SPA application using angular and the dependencies problem is fix :D .Conation
B
2

It is possible to include javascript frameworks as <dependency> via WebJars: http://www.webjars.org/documentation

You could then include e.g. AngularJs like that:

<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>angularjs</artifactId>
    <version>1.4.8</version>
</dependency>

WebJars are also hosted on maven central repository: http://search.maven.org/#artifactdetails%7Corg.webjars.bower%7Cangularjs%7C1.5.0-rc.1%7Cjar

Bydgoszcz answered 24/1, 2016 at 22:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.