Commit 7bdc6fee authored by BONNEFILLE Guilhem's avatar BONNEFILLE Guilhem Committed by Guilhem Bonnefille
Browse files

feat: Add a MAVEN_PROJECT_DIR

Needed to control root directory in a monorepo project.
For example, project with frontend in JS and backend in Java.
parent aba4ccb6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ The Maven template uses some global configuration used throughout all jobs.
| Name                  | description                            | default value     |
| --------------------- | -------------------------------------- | ----------------- |
| `MAVEN_IMAGE`         | The Docker image used to run Maven <br/>:warning: **set the version required by your project** | `maven:latest` |
| AVEN_PROJECT_DIR`     | Maven projet root directory | `.` |
| `MAVEN_CFG_DIR`       | The Maven configuration directory      | `.m2`             |
| `MAVEN_OPTS`          | [Global Maven options](http://maven.apache.org/configure.html#maven_opts-environment-variable) | `-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${MAVEN_CFG_DIR}/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true` |
| `MAVEN_CLI_OPTS`      | Additional [Maven options](https://maven.apache.org/ref/3-LATEST/maven-embedder/cli.html) used on the command line | `--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true` |
+6 −0
Original line number Diff line number Diff line
@@ -9,6 +9,12 @@
      "description": "The Docker image used to run Maven - **set the version required by your project**",
      "default": "maven:latest"
    },
    {
      "name": "MAVEN_PROJECT_DIR",
      "description": "Maven project root directory",
      "default": ".",
      "advanced": true
    },
    {
      "name": "MAVEN_CFG_DIR",
      "description": "The Maven configuration directory",
+7 −3
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
# Floor, Boston, MA  02110-1301, USA.
# =========================================================================================
variables:
  # Default Maven project root directory
  MAVEN_PROJECT_DIR: .

  # Maven image (can be overridden)
  MAVEN_IMAGE: "maven:latest"

@@ -450,6 +453,7 @@ stages:
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
    - eval_java_proxy_args
    - eval_mvn_settings_opt
    - cd ${MAVEN_PROJECT_DIR}
  # Cache downloaded dependencies and plugins between builds.
  # To keep cache across branches add 'key: "$CI_JOB_NAME"'
  cache:
@@ -472,9 +476,9 @@ mvn-build:
    when: always
    reports:
      junit:
        - "**/target/*-reports/TEST-*.xml"
        - "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml"
    paths:
      - "**/target"
      - "${MAVEN_PROJECT_DIR}/**/target"
  rules:
    # exclude merge requests
    - if: '$CI_MERGE_REQUEST_ID == null'
@@ -533,7 +537,7 @@ mvn-dependency-check:
    expire_in: 1 day
    when: always
    paths:
      - "**/target/dependency-check-report.*"
      - "${MAVEN_PROJECT_DIR}/**/target/dependency-check-report.*"

mvn-forbid-snapshot-dependencies:
  extends: .mvn-base