The workshop requires that you download some applications to be able to complete the tasks on the day. You should do these tasks before the workshop as some of the files are large.
The tasks that will be the following
- Download Java SDK
- Install one of the following IDE's, Intellij/Eclipse, IntelliJ is recommended
- Download the baseline project for the labs
-
Visit https://adoptopenjdk.net
-
Next follow the steps to install the package you have downloaded.
- Windows - Install page
- Mac - Install page
The next stage is to install an IDE
It is worth noting that Gradle 6 has been released and does not work well with older version of Intellij. To avoid any problems please upgrade to the latest
- Visit https://www.jetbrains.com/idea/download/#section=mac
- Select the Ultimate or Community Edition and download. Ultimate has a 30 day trial which is nice to use if you have a free trial available. Community Edition is missing a few features from Ultimate but none that matter for this workshop and is completely free
- Windows - Run the downloaded EXE file
- Mac - Run the downloaded PKG file
- Configure the SDK
- Visit https://www.eclipse.org/downloads/packages/
- Find the "Eclipse IDE for Java Developers" and download the version for you operating system
- Windows - Unzip the downloaded zip folder and run the eclipse.exe file
- Mac - Open the DMG file and eclipse will install
In order to save time during the workshop it would useful for you to download the baseline SpringBoot project and cache some of dependencies that will be needed for the labs.
The following URL is pre-configured to take you directly to https://start.spring.io and set the required dependencies to Spring Web and Spring Contract Verifier. Open your browser and enter the URL, and then click on "Generate" to download a zip file containing the project.
https://start.spring.io/#!type=gradle-project&language=java&platformVersion=2.7.0&packaging=jar&jvmVersion=11&groupId=com.jpgough&artifactId=apiworkshop&name=apiworkshop&description=Starter%20api%20workshop%20project&packageName=com.jpgough.apiworkshop&dependencies=web,cloud-contract-verifier
Unzip the downloaded archive to a location on your file system.
Whilst testing the setup of this lab I have found a bug in Spring Initializr. To fix this issue, you will need to replace the following in the build.gradle:
tasks.named('contracts') {
testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
failOnNoContracts = false
}
with
contracts {
testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
}
Import the project into IntelliJ by opening the the build.gradle
file as a project.
On hitting OK the project will most likely download the internet (or at least all the required dependencies). Once this has completed your baseline project is ready. You can try running the tests to verify that your project builds and the context loads correctly.
File ->
Import ->
Gradle ->
Existing Gradle Project.
Follow the wizard to bring in the project and resolve the dependencies.
You will need to make some changes to the build.gradle file to allow it to work from the beginning. The setup for Spring Cloud Contracts which will be discussed in 02-contracts needs a little change.
In the build.gradle file overwrite the small sction called contracts
to the following:
contracts {
testFramework = org.springframework.cloud.contract.verifier.config.TestFramework.JUNIT5
failOnNoContracts = false
}
Now simply run gradlew test
from the command line to verify that the base project works as expected.
The following additional installations allow you to complete all the workshop extension tasks. You do not have to install them to complete the core of this workshop.
We will be making requests to the services we build so it is really useful to have a rest client. Please use any of the suggested options:
- In IntelliJ there is one available in Tools -> HTTP Client -> Test RESTful Web Service
- For Windows or Mac POSTman
- For chrome restlet client
We next need to install Docker. First it is necessary to create a Docker account.
-
To create a Docker account visit the following website and register: https://hub.docker.com/signup
-
Next depending on your system you will need to choose the Docker version to install
-
For Windows 10 Home Edition you will need to install the legacy Docker Toolbox. The instructions can be found here and are indepth so should be followed carefully
-
For Mac or any other Windows Edition Visit https://hub.docker.com/?overlay=onboarding
- Follow the first step to download Docker for your operating system
- Run the downloaded file
- Windows run the EXE file
- Mac run the DMG file
- If you wish continue with the rest of the docker guide, however, it is not important
-
As part of the workshop we will require the downloading of some docker images. These can be quite large so to save time it may be simpler to download these now
- Open a cli
- Windows - Powershell
- Mac - terminal
- Execute the following commands
docker pull postgres:latest
docker pull dius/pact-broker:latest
docker pull jpgough/api-workshop-gateway
docker pull gradle:jdk11