Clean Code Workshop Base

Before the Clean Code workshop everyone should install the required tools and test if the project compiles and runs.

Requirements

You need the following tools to run and compile this project:

Setup environment variables

Set the JAVA_HOME and MVN_HOME variable via the command line:

  • Open Command Prompt/Terminal (make sure you Run as administrator so you're able to add a system environment variable).
  • Set the value of the environment variables to your installation paths as follows:

Windows:

setx -m JAVA_HOME "C:\Progra~1\Java\jdk1.8.0_XXX"
setx -m MVN_HOME "C:\Progra~1\apache-maven-3.X.X"

setx PATH=%PATH%;%JAVA_HOME%\bin
setx PATH=%PATH%;%MVN_HOME%\bin

Linux:

setenv JAVA_HOME jdk-install-dir
setenv MVN_HOME mvn-install-dir

setenv PATH $JAVA_HOME/bin:$PATH
export PATH=$JAVA_HOME/bin:$PATH

setenv PATH $MVN_HOME/bin:$PATH
export PATH=$MVN_HOME/bin:$PATH
  • Restart Command Prompt/Terminal to reload the environment variables then use the following command to check that they've been added correctly.
echo %JAVA_HOME%
echo %MVN_HOME%
echo %PATH%

Build & Test

Open Command Prompt/Terminal and run the following command:

mvn clean install

It will download the necessary dependencies, run the junit tests and compile the project.

When the build is success, then generate a .jar file under the target folder.

You can the .jar file run with the following command:

java -jar clean-code-workshop-1-1.0-SNAPSHOT.jar