= openKonsequenz - How to build the module "Statement Public Affairs"
:Date: 2020-06-09
:Revision: 0.3.0
:icons:
:source-highlighter: highlightjs
:highlightjs-theme: solarized_dark

<<<

== Requirements
* Node.js 12.17.0
* Apache Maven 3.6.3
* Openjdk 1.8.0_252

== Building the back end

=== Environment

Verify that your environment is set up correctly.

The java version of the JDK should match 1.8.0

[source,command]
----
    $ java -version
----
The JAVA_HOME environment variable should point to the jdk home folder.

The maven version should match 3.6.8

[source,command]
----
    $ mvn --version
----

=== Get back end sources

Clone the back end sources with a git client.

=== Configuration

To include the configuration within the deployment artifact, the configuration file application.yml in src/main/resources can be replaced.
You can find a detailed description of the available configuration parameters in the howToRun document.

=== Build and test

To build the back end move to the project base folder

The following command builds a new artifact, runs unit tests to verify the implementation and stores the artifact and the test results within the target/ folder.

Build war for Apache Tomcat:
[source, command]
----
    $ mvn clean install
----

Build jar for stand alone Java Spring application:
[source, command]
----
    $ mvn clean install -Dp.type=jar
----

To speed up the build you can skip testing.
[source, command]
----
    $ mvn clean install -DskipTests
----

The target/ folder should then contain a web application archive named statement-public-affairs.war


== Building the front end

=== Environment

Verify that your environment is set up correctly.

The node version should match 12.17.x.

[source, command]
----
    $ node --version
----

=== Get front end sources

Clone the front end sources with a git client.


=== Configuration

All relevant configurations for the front end can be found in the file `app.config.json`. This file is required for
compilation, thus changes to it take only effect after building the front end.
Please visit the *howtoRun* documentation for more information on a detailed overview of the configurable parameters.

=== Build and test

To build the front end, move to the project base folder.

The following command installs all dependencies via npm and is required before starting the build or any tests.

[source, command]
----
    $ npm install
----

After successfully installing all dependencies, the following command builds new artifacts and stores them in the `dist/` folder.

[source, command]
----
    $ npm run build
    $ npm run build:archive
----

Tests and static code analysis can be executed with the following commands. The generated test report can then be found in the `coverage/` folder. Reports for the static code analysis can be found in the files `lint.ts.report.json` and `lint.styles.report.json` for all typescript and (s)css code. 

[source, command]
----
    $ npm run test:report
    $ npm run lint:report    
----


TIP: Next Step -> Read the *howToRun* documentation!


