Skip to content

Maven build

Angular2Guy edited this page Nov 20, 2016 · 11 revisions

Build an optimized Ear

The maven build is done according to the archetype of JBoss for ear packages.

Ear project

In the ear project the war and ejb dependencies bundled by the maven ear plugin into an ear package for deployment.

Ejb project

In the ejb project the sources and resources are build and bundled in a ejb jar.

War project

In the war project are several steps performed.

  1. The directories dist/ and node_modules are cleaned
  2. The directory src/main/angular2 is copied to target (without dependencies only a few kb)
  3. In target/angular2/carrental/ npm install is called to resolve the dependencies
  4. In target/angular2/carrental/ ng build --prod --base-href "/carrental-web/" is called to build an optimized bundle. (--base-href is needed to set baseref)
  5. The war plugin includes the directories for the Angular Cli bundle and the translations and builds the war.

The command ng build --prod --base-ref "carrental-web" builds a tree shaken/uglified bundle with the right bref for routing to work. Angular Cli will offer the --aot option for further optimization and splitting of the bundle according to routes.

Clone this wiki locally