WebJars Officially Launched!

Check it out: webjars.org

Back in April I started an experiment called “WebJars” to see if it would be useful to package web libraries (JavaScript, CSS, etc) as Jar files. WebJars allow you to declaratively set client-side application dependencies just like we do for the server-side. A nice side effect of this is transitive dependencies. For instance, if you specify Bootstrap 2.2.1 as a dependency, then you automatically also get jQuery 1.8.2 as well. WebJars also make it easy to know what versions of web libraries are being used since not all web libraries use versions in their naming conventions.

Today WebJars are moving from an experiment to something real! I’ve launched the new webjars.org site and released all of the WebJars to Maven Central. The new site has a list of all the WebJars and documentation on how to use WebJars in Play 2, Servlet 3, Dropwizard, and Spring MVC apps.

I hope that WebJars help you build modern web applications! Let me know what you think of WebJars. Thanks!

This entry was posted in WebJars. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • http://twitter.com/david_welch David Welch

    Glad to see you’re still running this down. We recently created a reusable jar for some client side code that multiple products required and it’s turned out to be very useful, though I hadn’t thought about the transitive dependency idea.

  • zproxy

    Have you done some benchmarking on how much performance gains there are? Some graphs would be nice too :) How does it compare to the chrome packaged apps/ crx efforts?

    • http://www.jamesward.com James Ward

      I’m not sure about direct performance. There is probably a bit of a hit to read the assets out of the Jar. But ideally most modern apps will use a CDN instead of directly loading them. In the future I will look into caching and other performance optimizations.

  • http://twitter.com/ncornag Nicolás Cornaglia

    Fantastic idea! I package my own jars, but this is obviously more useful.
    I use maven do it and upload the jars to our Nexus, with the aid of “wagon-maven-plugin” to downloads and maven-antrun-plugin+unzip to filter the files.
    Will start to use the webjasrs asap!

  • Daniel Grob

    I like those WebJars! Thanx for creating them!

    I already use the WebJar for jQuery UI and for angular. But I miss a WebJar for some other JavaScript libraries I use, e.g. less. How can I create new WebJars?

    • http://www.jamesward.com James Ward

      You can look at the existing WebJars source to see how to create a new one. Then file a new issue to have me pull it into the repo.

  • Olivier Poppon

    I don’t know if it is the right place to post issues, sorry if not.I am trying to install web jars with Play 2.1 RC1 and I have a strange problem.
    I think I have followed the instruction to configure Build.scala (using webjars-play 0.1 and bootstrap 2.2.1 in the dependencies), adding a new route (with WebJarAssets)
    After I run the application (from the console), I refresh the browser and…wait…wait…No html seems to be sent by the framework.

    Any idea ?Thanks a lot

  • Olivier Poppon

    I just found another post where you mentionned to use webjar-play 2.1-RC1…sorry about that

    • http://www.jamesward.com James Ward

      No problem. Let me know if it works for you.

  • Bruno Santos

    Great work James! A very neeto tool indeed! Thanks!

  • Bruno Santos

    James,

    I have an issue running some jasmine tests from maven. Basically, they can not find the jquery that it’s being imported from a webjar (which makes sense). On your experience, is there any idea on how to best fix this issue?

    Thanks

    • Bruno Santos

      For the moment, the maven dependency plugin is being used in order to unpack the webjars into the target/jasmine directory so that the javascript deps are available for jasmine tests.
      Is anyone aware of a better and simpler way?

  • Henning Hoefer

    I have a question: On webjars.org all dependency-snippets are given as compile time dependencies. Why is that? Wouldn’t runtime scope be more accurate (and possibly faster to compile)?

    • http://www.jamesward.com James Ward

      That is a good question. Have you tried using runtime scope? Does it work with all of the documented frameworks? If so then I’d be happy to change this.

  • RdeWilde

    How about the official CDN’s? Are those enabled by default? Or do I still have to configure this manually? Examples like jquery, bootstrap… Should not serve it local, but make use of the cache that’s already there “from” other sites…



  • View James Ward's profile on LinkedIn