Calculator web application demo project, used for various training classes around continuous delivery by Praqma.
The project was earlier called Praqma training RoadShow, so there is a bit legacy and some hack, leaving room for exercises :-)
-
Uses Gradle to build
-
Can deploy web app t Tomcat server
-
Can run Selenium tests againt deployed web app
-
Release and publishing of artifacts are supported
-
You only need a JVM to run Gradle for playing with the basic setup on your own machine.
The project uses Gradle as build tool, and as such only requires you have JVM to run gradle.
To use gradle in the project, run the gradle wrapper script (which is checked into the repository):
- Linux:
./gradlew
(this will be used in examples below) - Windows:
./gradlew.bat
It will list a short help.
Gradle uses the concept of a task for what to do, like build, run tests etc.
The Gradle wrapper script (gradlew
and gradlew.bat
) is part of the project to ensure only a JVM is needed as dependency for building. Gradle will take care of the rest.
This could some of the things you would like to do in your Jenkins jobs.
Build source, compile unit test and run unit test:
./gradlew war test
Build war file that can be deployed to Tomcat, and reports unit test results to build/test-results/
.
To enable manual build support on a Jenkins job, use the special jenkinstest
task instead of test
to ensure new timestamps on junit outpu files that the Jenkins JUnit plugin requires.
./gradlew war jenkinstest
Cleaning, doing every gradle tasks from scratch:
./gradlew clean
./gradlew jacocoTestReport
tasks measures and reports coverage on unit tests.
You can run all supported static analysis checks with:
./gradlew staticanalysis
It will check on both main and test sources and report to xml files.
There are different analysis available:
- PMD
- checkstyle
- Fingbugs
- jdepend
They all have both a Main and Test task, that analysis respectively main sources or test sources.
For example pmdMain
or findbugsTest
.
The built in gradle tasks check
will also run all of the static analysis tools goals, including the test
tasks which is unit test.
./gradlew check
You can generate javadoc on the sources with:
./gradlew javadoc
For training classes, that uses shared artifact- and web-server, you need to make sure both webapp and artifact have a unique name.
Patch the following line in build.gradle
replacing mytrainingusername with your own name, initial or Github account id.
ext.trainingUserName = 'mytrainingusername' // it is a good idea to chose the same as your github id
NTNUrocks!!!