Add javascript dependencies like java dependencies in maven 2?

I use apache maven for the build project, so I want to add my javascript framework dependencies automatically based on their version, organizing javascript frameworks, and loading only modifications to the shortcut version. Is there some kind of plugin similar to java dependencies or alternative with maven?

+6
source share
2 answers

There is a standard way to do this using the api servlet function of version 3. Any bank can set up web resources (javascripts, css, images, etc.), which are located in the META-INF / resources section.

To solve your problem, I would create a maven project of type "jar" for each javascript infrastructure that you want to reuse in your webapp projects.

The only caveat is that 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/

Api 3 servlet link: http://download.oracle.com/otndocs/jcp/servlet-3.0-fr-eval-oth-JSpec/

+11
source

You can enable javascript frameworks as <dependency> via WebJars: http://www.webjars.org/documentation

Then you can enable, for example, AngularJs like this:

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

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

+1
source

Source: https://habr.com/ru/post/945523/


All Articles