I have been experimenting with no success whatsoever, I am running a Gitlab hosted on Linux, and trying to get my head around the CI functionality.
According to the Gitlab documentation you only need to create a .gitlab-ci.yml
file, the Gitlab implementation of Travis-CI. Now from the looks of it you can accomplish a lot with the .gitlab-ci.yml
, but a lot of the documentation is referencing Ruby and other languages. Nothing is said about how to build Java Maven projects.
How can I build a simple application in Java? Can I use the shared runner, or should I be using a specific runner, in that case what or which runner implementation should I choose: ssh, docker, or shell? Then, what should I put in the .gitlab-ci.yml
file at least to build the project with Maven?
GitLab CI/CD is the part of GitLab that you use for all of the continuous methods (Continuous Integration, Delivery, and Deployment). With GitLab CI/CD, you can test, build, and publish your software with no third-party application or integration needed.
Register a Docker runner and use one of the official Maven Docker images, e.g., maven:3-jdk-11
in your .gitlab-ci.yml
file:
image: maven:3-jdk-11 build: script: "mvn install -B"
Note the -B
flag, which is recommended for non-interactive use.
As far as I understand, it does not matter whether the runner is shared or specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With