-
Install Java JDK 12 (recommended)
- Go to Java JDK downlaod page: https://jdk.java.net/12/
- Download the right installer version for your operating system (.exe, .dmg, .deb)
- Install the Java JDK
- Make sure the JAVA_HOME path is set to the JDK (you can check it with maven later)
-
Install Maven
- Go to Maven download page: https://maven.apache.org/download.cgi
- Download the zip version
- Extract the files to their final location (e.g.
C:\\Program Files\maven
or a Unix loaction) - Add the bin path from the maven folder to your PATH environment variable
- Check installation with
mvn --version
(Important is the Java and the Maven version)Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00) Maven home: C:\Program Files\Java\apache-maven-3.6.1\bin\.. Java version: 12.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-12.0.1 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
-
Install the packages
-
Install Variant 1: (recommended)
- Download a release as jar file from the releases: https://github.com/polylith/java-challenge-template/releases
- Run the following command. Remember to set the
-Dfile
Parameter to the path to the jar file from step 1.mvn install:install-file -Dfile=<path-to-jar> -DgroupId=de.entwicklerheld -DartifactId=java-challenge-template -Dversion=1.0-SNAPSHOT -Dpackaging=jar
-
Installation Variant 2:
- Clone repo
- Run
mvn clean install
-
-
Now you are ready to create a java-challenge-project. Please read the Create the Project section
-
If you cloned the git repo:
- Move to the target directory
-
If you installed it with the jar file:
- Go to the final loaction for your project
-
Run following command in the target folder. It will create a new directory for the project according to your artifact id. Don't forget to set the
-DartifactId
Parameter to the short name of your Challenge.mvn archetype:generate -DarchetypeGroupId=de.entwicklerheld -DarchetypeArtifactId=java-challenge-template -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=de.entwicklerheld -DartifactId=<name-of-your-challenge>
-
You will be asked to specify a version:
Define value for property 'version' 1.0-SNAPSHOT: :
Just press Enter here -
You will be asked to specify a a short name for the Challenge:
Define value for property 'shortName':
Enter the name of you challenge without dashed or underscores (it is used in package names) here. -
Now open the created folder named like your project name with your favorite IDE
-
If your Java Version is not correct insert the following to your pom.xml and run
mvn install
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>8</release> </configuration> </plugin>
- A Challenge includes the following parts:
- A Blank Template for the User
- Unit-tests for all tasks and stages
- Write the blank template
- The blank template is located at:
scr/main/java/de/entwicklerheld/<challenge-name>\challenge\stage1\Example.java
- Remeber to rename the filename if you change the classname
- For unimplementet functions use
RuntimeException
- For testing purpose you can write your implementation to this file
- The blank template is located at:
- Write the JUnit test
- The JUnit version is JUnit 5. Please read the documentation even if you know JUnit 4, because some major things changed.
- Please be aware of adding messages to the assertion
- The tests are located at:
scr/test/java/de/entwicklerheld/<challenge-name>\challenge\stage1\ExampleChallengeTest.java
- Remeber to rename the filename if you change the classname
- Tests need to be repeatable and must have enough testcases to avoid hardcoding
- Write the story flow:
- The story flow file is located at:
scr/test/java/de/entwicklerheld/<challenge-name>\challenge\stage1\stage1.md
- There is no formatting needed, its only the plain story text. You can use .md commands in this file to structure it.
- The story flow file is located at:
- Make shure to clear your implementation from the blank template
- Run the shurefire plugin with the commmand in your project folder
mvn surefire:test
- There are two different options to send your work to EntwicklerHeld:
- Create a Github project and share the link with EntwicklerHeld
- Zip your projectfolder and send it over to EntwicklerHeld