Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ The Maven template uses some global configuration used throughout all jobs. ...@@ -22,6 +22,7 @@ The Maven template uses some global configuration used throughout all jobs.
| Name | description | default value | | Name | description | default value |
| --------------------- | -------------------------------------- | ----------------- | | --------------------- | -------------------------------------- | ----------------- |
| `MAVEN_IMAGE` | The Docker image used to run Maven <br/>:warning: **set the version required by your project** | `maven:latest` | | `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_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_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` | | `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` |
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
"description": "The Docker image used to run Maven - **set the version required by your project**", "description": "The Docker image used to run Maven - **set the version required by your project**",
"default": "maven:latest" "default": "maven:latest"
}, },
{
"name": "MAVEN_PROJECT_DIR",
"description": "Maven project root directory",
"default": ".",
"advanced": true
},
{ {
"name": "MAVEN_CFG_DIR", "name": "MAVEN_CFG_DIR",
"description": "The Maven configuration directory", "description": "The Maven configuration directory",
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
# Floor, Boston, MA 02110-1301, USA. # Floor, Boston, MA 02110-1301, USA.
# ========================================================================================= # =========================================================================================
variables: variables:
# Default Maven project root directory
MAVEN_PROJECT_DIR: .
# Maven image (can be overridden) # Maven image (can be overridden)
MAVEN_IMAGE: "maven:latest" MAVEN_IMAGE: "maven:latest"
...@@ -450,6 +453,7 @@ stages: ...@@ -450,6 +453,7 @@ stages:
- install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
- eval_java_proxy_args - eval_java_proxy_args
- eval_mvn_settings_opt - eval_mvn_settings_opt
- cd ${MAVEN_PROJECT_DIR}
# Cache downloaded dependencies and plugins between builds. # Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"' # To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache: cache:
...@@ -472,9 +476,9 @@ mvn-build: ...@@ -472,9 +476,9 @@ mvn-build:
when: always when: always
reports: reports:
junit: junit:
- "**/target/*-reports/TEST-*.xml" - "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml"
paths: paths:
- "**/target" - "${MAVEN_PROJECT_DIR}/**/target"
rules: rules:
# exclude merge requests # exclude merge requests
- if: '$CI_MERGE_REQUEST_ID == null' - if: '$CI_MERGE_REQUEST_ID == null'
...@@ -533,7 +537,7 @@ mvn-dependency-check: ...@@ -533,7 +537,7 @@ mvn-dependency-check:
expire_in: 1 day expire_in: 1 day
when: always when: always
paths: paths:
- "**/target/dependency-check-report.*" - "${MAVEN_PROJECT_DIR}/**/target/dependency-check-report.*"
mvn-forbid-snapshot-dependencies: mvn-forbid-snapshot-dependencies:
extends: .mvn-base extends: .mvn-base
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment