Reputation: 41213
I have a Spring Boot project that builds using a bootJar task in gradle. It produces a runnable ____-1.0-SNAPSHOT.jar file. Now, I want to leverage GitLab CI to build the JAR and make releases.
There didn't seem to be an obvious way to do the builds. I started looking at the researchgate gradle plugin. It seems promising but has a lot of assumptions.
What is the best way to get the release JARs out of GitLab CI?
Upvotes: 2
Views: 4983
Reputation: 183
Ruwanka provided a great answer, however I believe it is now a bit outdated. GitLab.com (and self-hosted) now supports hosted maven repositories as a native feature of their Premium tiers.
More information regarding how to deploy a java application (JAR, etc.) for private or public consumption can be found here:
Upvotes: 0
Reputation: 3755
There is couple of ways of getting released artifacts from gitlab ci pipeline.
Here is the sample .gitlab-ci.yml which uses gitlab job artifacts functionality (assume gradle wrapper is used)
image: java:8-jdk
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
# define path to collect artifacts
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
only:
- master
Upvotes: 1