Skip to content

Commit 70862ec

Browse files
committed
build(versions): replace IGNORED_VERSIONS with MAVEN_CLI_OPTS
1 parent cbb6222 commit 70862ec

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ jobs:
6363
steps:
6464
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
6565
- name: Check the versions
66-
uses: docker://leplusorg/maven-check-versions:3.9.8@sha256:83d9758a4a0626f58376924c602919f14a782aa49e5e2bfb86de1f797de16cdd
66+
uses: docker://leplusorg/maven-check-versions:3.9.9@sha256:abdd53328be1c87d7bf21b868d47d7934b28dfc66e168d9625877616ab14d6da
67+
env:
68+
MAVEN_CLI_OPTS: "-DprocessDependencyManagementTransitive=false '-Dmaven.version.ignore=(?i).+-(alpha|beta).+,(?i).+-m\\d+,(?i).+-rc\\d+'"
6769
```
6870
6971
This way the action can be triggered manually and otherwise it runs
@@ -76,20 +78,24 @@ To use this container in a GitLab step, add the following step to the stage of y
7678
```yaml
7779
maven check versions:
7880
image:
79-
name: leplusorg/maven-check-versions:3.9.8@sha256:83d9758a4a0626f58376924c602919f14a782aa49e5e2bfb86de1f797de16cdd
81+
name: leplusorg/maven-check-versions:3.9.9@sha256:abdd53328be1c87d7bf21b868d47d7934b28dfc66e168d9625877616ab14d6da
8082
script:
8183
- "/opt/maven-check-versions.sh"
84+
variables:
85+
MAVEN_CLI_OPTS: "-DprocessDependencyManagementTransitive=false '-Dmaven.version.ignore=(?i).+-(alpha|beta).+,(?i).+-m\\d+,(?i).+-rc\\d+'"
8286
```
8387
8488
## Ignoring versions
8589
8690
You can define which versions should be ignored using the
87-
`IGNORED_VERSIONS` OS environment variable which will be passed to the
88-
maven versions plugin as `maven.version.ignore` (see here for
89-
[details](https://www.mojohaus.org/versions/versions-maven-plugin/version-rules.html#Using_the_maven.version.ignore_property)).
90-
For example, you can set `IGNORED_VERSIONS` to
91-
`(?i).+-(alpha|beta).+,(?i).+-m\\d+,(?i).+-rc\\d+` to ignore alpha,
92-
beta, mark or release candidate versions.
91+
`maven.version.ignore` system property (see here for
92+
[details](https://www.mojohaus.org/versions/versions-maven-plugin/version-rules.html#Using_the_maven.version.ignore_property)). To
93+
set `maven.version.ignore` inside the Docker container, you need to
94+
override the default `MAVEN_CLI_OPTS` OS environment variable which
95+
will be passed to the maven CLI command. For example, you can set
96+
`MAVEN_CLI_OPTS` to `-DprocessDependencyManagementTransitive=false -Dmaven.version.ignore=(?i).+-(alpha|beta).+,(?i).+-m\\d+,(?i).+-rc\\d+`
97+
to ignore transitive dependencies and all alpha, beta, mark or release
98+
candidate versions.
9399

94100
## Manually using Docker
95101

maven-check-versions/maven-check-versions.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,15 @@ else
5858
cmd=$(\which mvn)
5959
fi
6060

61-
if [ -z "${IGNORED_VERSIONS+x}" ]; then
62-
IGNORED_VERSIONS=''
63-
fi
64-
6561
if [ -z "${MAVEN_CLI_OPTS+x}" ]; then
66-
opts=()
62+
opts=('-DprocessDependencyManagementTransitive=false')
6763
else
6864
IFS=' ' read -r -a opts <<<"${MAVEN_CLI_OPTS}"
6965
fi
7066

7167
rc=0
7268

73-
"${cmd}" "-DprocessDependencyManagementTransitive=false" "-Dmaven.version.ignore=${IGNORED_VERSIONS}" "${opts[@]+"${opts[@]}"}" \
69+
"${cmd}" "${opts[@]+"${opts[@]}"}" \
7470
versions:display-dependency-updates \
7571
versions:display-plugin-updates \
7672
versions:display-property-updates |

0 commit comments

Comments
 (0)