最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

add javascript dependencies like java dependencies in maven 2? - Stack Overflow

programmeradmin1浏览0评论

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 ?

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 ?

Share Improve this question asked May 21, 2013 at 21:31 cflores29cflores29 3741 gold badge6 silver badges16 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 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./2010/04/28/web-inflib-jarmeta-infresources/

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

It is possible to include javascript frameworks as <dependency> via WebJars: http://www.webjars/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/#artifactdetails%7Corg.webjars.bower%7Cangularjs%7C1.5.0-rc.1%7Cjar

发布评论

评论列表(0)

  1. 暂无评论