thad eirich

Using Maven to package and then deploy Ember-CLI assets as a WAR

Created at: 2014-10-17 14:21:44 UTC

Updated on: 2014-10-17 14:38:33 UTC

Recently I was asked to develop an EmberJS application for a client and one of the requirements was that the application needs to be deployed, much to my dismay, on WebLogic. I tried explaining to the client that they were better off deploying the Ember’s static assets on a separate Apache webserver, or even filtering the requests under Embers base route to an Apache on the same server. However, this was for a Java shop and I was told the application had to follow their standard deploy process.

And so I began!

First I created a WEB-INF in the root of my Ember-CLI directory with an empty web.xml & a simple weblogic.xml with a context root for the ember application.

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "">


<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "">

Next I created a pom.xml so I could manage the build process with Maven. I added no dependencies and the only plugin you need is the maven-assembly-plugin which allows you to filter out files by extension in your build path & package them as a WAR (or zip or whatever).

<project xmlns="" xmlns:xsi=""

<!-- assamble static content -->

The maven-assembly-plugin pulls it’s configuration from a file called static.xml which I’ve copied below. In this case I have it configured to pull anything out of my dist folder (automatically generated by Ember CLI) and anything out of the WEB-INF folder I just created.

Now that everything’s in place, the WAR build process is as follows. `ember build`, `mvn package` & WAR file should now be located in your project root, /target/EmberApp.WAR. The WAR can just be deployed as a normal web application in weblogic.

Note! If you begin encountering problems requesting your other Ember assets, it’s probably because you didn’t establish your baseURL in config/environment.js. In this case you would change the value of baseURL to ‘/emberApp/’. Also, at the time of CLI 0.1.0 I get compatibility problems in IE if I don’t also set the router rootRUL to the same value. So your app/router.js should look something like:

var Router = Ember.Router.extend({
location: YourEmberNamespaceENV.locationType,
rootURL: YourEmberNamespaceENV.baseURL

maven ember emberjs ember-cli cli package deploy weblogic WAR java