stages:
  - build
  - test

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"

cache:
  paths:
    - .m2/repository

before_script:
  - export MAVEN_CLI_OPTS="--batch-mode --errors --fail-at-end --show-version"

build:
  stage: build
  image: maven:3.8.5-openjdk-17
  script:
    - mvn $MAVEN_CLI_OPTS clean install
  artifacts:
    paths:
      - target/*.jar

test:
  stage: test
  image: maven:3.8.5-openjdk-17
  script:
    - mvn $MAVEN_CLI_OPTS test