I'm a junior developer introducing unit testing to a project using SBT with Java 11. In my team of 3, they never wrote any kind of unit testing.
We are planning to start it now.
We have a self-hosted TeamCity CI/CD setup for unit testing. The default TeamCity runner agent (Docker) uses Java 17.
How can I install Java 11 within the existing runner or create a new runner with Java 11?
Installed runner using this
docker run -e SERVER_URL="http://<My self hosted server URL>:8111" jetbrains/teamcity-agent
Steps to install Java 11 in TeamCity via Docker :**
Create a Docker
file.
FROM jetbrains/teamcity-server:latest
RUN apt-get update && \
apt-get install -y openjdk-11-jdk
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
RUN update-alternatives --set java $JAVA_HOME/bin/java
EXPOSE 8111
CMD ["/opt/teamcity/bin/teamcity-server.sh", "run"]
Build the Docker file via below command:
docker build -t teamcity-with-java11
Run the Teamcity container via below command:
docker run -it --name teamcity-instance -p 8111:8111 teamcity-with-java11
Once the container is up and running, try to access TeamCity
via http://localhost:8111.