heidloff.net - Building is my Passion

Maven Plugin to install Web Resources in Bluemix Java Projects via Bower

Similarly to the dependency managers mvn, npm, cocoapods, etc. Bower is a nice dependency manager for web resources to pull down JavaScript, CSS and other files. This makes it easy for developers to find and install certain libraries. Plus the same functionality can be integrated in the build process.

Using Bower as part of a build might make sense if, for example, you want to get latest versions of libraries with security fixes automatically. If you want to open source code, it might also make it easier for you to only refer and not include third party libraries dependent on your corporate open source policies.

I’ve found a nice Maven plugin to run Bower as part of a build and it works nicely, both locally as well as on Bluemix DevOps – frontend maven plugin. The plugin installs Node and npm and then Bower.

To define the web resources you want to download a bower.json file is used. With a .bowerrc file Bower can be configured, e.g. the target path for the web resources.

The installation of the Maven plugin is simple and well documented. Essentially you need to define the plugin in the pom.xml and you need a package.json file.

Here is how my sample Java project looks like before building it.


After a mvn build the web resources have been downloaded to the WebContent directory.


You don’t have to do anything else to use the same functionality on Bluemix DevOps. Just make sure you add the new files and folders to your .gitignore.


Featured Blog Posts
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Trending Tags