This is an example project that runs JavaScript unit tests (in this case Jasmine tests) driven by the Karma test runner during a Maven build. It also uses Webjars to manage web-resource dependencies.
This type of setup might be encountered in a Java service + Web UI project for example, or in an enterprise environment where CI builds are standardised around a Java + Maven workflow.
For more information check out this blog post describing the example.
- Java 1.7+
- Servlet 3.0
- Maven 3+
- Webjars
- maven-frontend-plugin
- Node.js
- Karma
- Jasmine
- AngularJS
To build and run this project you will need the following environment:
- Java 1.7+ (required for Jetty)
- Maven 3.0+ (tested on Maven 3.0.5)
Optionally:
- An IDE (e.g. Eclipse)
- Node.js (if you want to run other Node packages outside the CI build)
Run the project using the Jetty configuration specified in the POM file:
>> mvn jetty:run
Then access the project at:
http://localhost:8080/maven-karma-webjars-example/index.html
Note you can also run the application on any Servlet 3.0 compliant container (e.g. Apache Tomcat etc.).
The full CI build, including JS unit test execution, can be run via Maven:
>> mvn clean install
This project and all of its contents are release under the Apache 2.0 License.