-
Notifications
You must be signed in to change notification settings - Fork 32
Maven build
The maven build is done according to the archetype of JBoss for ear packages.
In the ear project the war and ejb dependencies bundled by the maven ear plugin into an ear package for deployment.
In the ejb project the sources and resources are build and bundled in a ejb jar.
In the war project are several steps performed.
-
The directories dist/ and node_modules are cleaned
-
The directory src/main/angular is copied to target (without dependencies only a few kb)
-
In target/angular/carrental/ npm install is called to resolve the dependencies
-
In target/angular/carrental/ ng build --prod --aot --base-href "/carrental-web/" is called to build an optimized bundle. (--base-href is needed to set baseref)
-
In target/angular2/carrental/ ng test --browser PhantomJS --reporters junit --single-run is called to run the jasmine tests for the carrental application. If a test fails the junit reporter breaks the build.
-
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 offers the --aot option for further optimization of the bundle. With aot a bundle per supported language needs to be build. The index.html page redirects to the language directory. The bundles for german and english are in the directories de and en. To make refresh work the url needs to be rewritten to the right application. For that the tuckey urlrewriter is used.
The command ng test --browser PhantomJS --reporters junit --single-run runs the Jasmine tests of the Angular 2 Application once on the PhantomJS browser. The PhantomJS browser is headless and can be used as npm dependency to run the tests on. The junit reporter of Karma returns a Junit Xml file to Maven that breaks the build if one of the tests fails. The Parameter --single-run tells Karma to run the tests once and then exit so that a build server has not stale processes in the background.
To build the application execute 'mvn clean install'.
The TravisCI build is here it executes the build process and and shows the build log. The result is the Ear.