Not too jarring

Managing web libraries as dependencies with WebJars

Elliot Bentley

James Ward of Typesafe officially launches WebJars project, with new website and support for Java web frameworks.

With modern websites becoming increasingly reliant on libraries like jQuery, Bootstrap and Backbone.js, managing these components also becomes increasingly annoying.

James Ward of Typesafe saw a parallel with the way Java libraries were once manually downloaded before the days of managed dependencies, and set about working on WebJars, a method for allowing the necessary JavaScript and CSS to be packaged as Jar files.

“Why not do with web libraries like we now do with Java libraries and specify them as managed dependencies?” he wrote in April. “This allows us to declaratively set the version, use a consistent version across an application, and easily deal with transitive dependencies.” For example, specifying Bootstrap 2.2.1 as a dependency includes jQuery 1.8.2 automatically.

While an initial experiment was released in April, yesterday Ward launched a new site for the project,, and released these WebJars to Maven Central. The new website also includes instructions for making WebJars compatible with web frameworks such as Play 2, Spring MVC and Servlet 3. Grails instructions are promised to be “coming soon”.

So far there are 31 libraries already available, including angularjs, ember.js and of course jQuery, and new frameworks can be requested as an issue on GitHub. Of course, keeping these libraries up-to-date is another story – but the open-source nature of the project should hopefully mean others can help contribute.

Photo by Kim Knoch.

Inline Feedbacks
View all comments