The Maven crawler looks recursively for all pom.xml files from a specific root directory, and tries to update the dependencies declared in each one.
Two things are updated per POM:
every entry under <dependencies>
the <parent> POM, when one is declared
This crawler is enabled by default, so it can be used either automatically by running updatecli diff from a directory containing the files to update, or by providing a manifest.
The automatic discovery behavior can be tuned by providing a YAML manifest with a maven crawler in top-level directive autodiscovery as explained in the "Autodiscovery" page.
Each dependency produces a maven source resolving the latest version, two xml conditions asserting that the groupId and artifactId still match, and an xml target writing the new version into the POM.
Unlike most crawlers, the version filter defaults to kind latest, because Maven coordinates do not reliably follow semantic versioning. Set an explicit versionfilter to constrain updates.
A dependency whose <version> is a property reference, such as ${junit.version}, is skipped. Updatecli does not resolve the property to find the literal it should rewrite.
“age” defines the minimum or maximum age of a release to be considered valid.
remark:
it accepts a duration string, such as “24h”, “7d”, “3w” or “1y”.
it is propagated to the generated maven sources.
a release’s age is the Last-Modified date the repository reports for its pom file.
On a repository reporting none, the generated sources are skipped.
by default, the age filter doesn’t make an update fall back to a version lower than
the one in pom.xml. A semver “versionfilter” excludes lower versions when the version
in pom.xml is a semantic version. Otherwise, such as with the default “latest” kind or
a version such as “5.3.0.Final”, the update waits until the version in pom.xml reaches
the “minimum” age. The “latest” kind can still pick a lower version the repository
released last, such as a backport. Set “allowdowngrade” to true to fall back to the
newest release old enough instead.
security fixes don’t wait for it, see “vulnerability”.
example:
age:
minimum: 7d
allowdowngrade
boolean
“allowdowngrade” defines whether an update can lower the version in use.
default: false
remark:
by default, an update never lowers the version in use. While every newer
release is too recent, the update is skipped.
when set to true, an update lowers the version in use when it doesn’t match the
age filter, to the newest release that does.
it only applies with a “minimum” or “maximum” age.
maximum
string
“maximum” defines the maximum age a release may have to be considered.
remark:
accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years,
plus the Go duration units such as “h”, “m” and “s”.
a unit is required.
a month counts as 1/12 of a year and a year as 365 days.
example:
maximum: 6mo
maximum: 1y
minimum
string
“minimum” defines the minimum age a release must have to be considered.
remark:
accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years,
plus the Go duration units such as “h”, “m” and “s”.
a unit is required.
a month counts as 1/12 of a year and a year as 365 days.
example:
minimum: 24h
minimum: 7d
minimum: 3w
groups
array
“groups” defines dependencies updated together, in one pipeline per group.
default:
empty, every dependency follows “groupby”.
remark:
“only” uses the same rules as the crawler “only” setting, and narrows it:
a group dependency must match both the crawler “only” and the group “only”.
A group rule combined with a crawler rule setting the same field to another value matches nothing.
a dependency belongs to the first group it matches.
dependencies matching no group follow “groupby”.
the group name is added to the generated pipeline IDs and action titles,
and set as the “updatecli.io/group” label, so “–labels updatecli.io/group:aws” selects them.
the name “default” is reserved for the dependencies matching no group.
“name” identifies the group in the generated pipelines.
remark:
it must be unique, start with a letter or a digit, and only contain letters, digits, “.” and “-”.
only
array
“only” defines the rules matching the dependencies of the group.
remark:
it accepts the same rules as the crawler “only” setting.
ignore
array
“ignore” defines rules to exclude matching Maven dependencies from the autodiscovery.
remark:
a Maven dependency is ignored when it matches at least one rule.
artifactids
object
“artifactids” defines the Maven artifacts to match, keyed by artifact ID.
remark:
an empty value matches any version.
otherwise the value is a semantic version constraint, such as “>=1.0.0”.
when the version or the constraint cannot be parsed, the value must equal the version.
groupids
array
“groupids” defines the Maven group IDs to match.
remark:
a dependency matches when its group ID equals one of the values.
path
string
“path” defines a pom.xml path pattern.
remark:
the pattern must match the whole path, not just a substring.
the pattern follows the Go filepath.Match syntax, such as “*” or “?”.
only
array
“only” defines rules to restrict the autodiscovery to matching Maven dependencies.
remark:
a Maven dependency is kept only when it matches at least one rule.
artifactids
object
“artifactids” defines the Maven artifacts to match, keyed by artifact ID.
remark:
an empty value matches any version.
otherwise the value is a semantic version constraint, such as “>=1.0.0”.
when the version or the constraint cannot be parsed, the value must equal the version.
groupids
array
“groupids” defines the Maven group IDs to match.
remark:
a dependency matches when its group ID equals one of the values.
path
string
“path” defines a pom.xml path pattern.
remark:
the pattern must match the whole path, not just a substring.
the pattern follows the Go filepath.Match syntax, such as “*” or “?”.
rootdir
string
“rootdir” defines the directory where the crawler starts searching for pom.xml files.
default:
the scm directory when “scmid” is set, otherwise the directory relative paths resolve from, by default the working directory.
remark:
a relative path is resolved from the default directory.
an absolute path is used as is, instead of the scm directory.
tracks
array
“tracks” defines an ordered list of tracks, each one choosing versions its own way.
The crawler runs once per track, and each track gets its own pipelines.
default:
empty, the crawler runs once with its own settings.
remark:
each track requires a “name”, and sets “versionfilter”, “age” or both.
a setting used by a track can’t also be set on the crawler,
so a track without it uses the crawler default.
“age” is only accepted by crawlers supporting it.
the name is added to the generated pipeline IDs and action titles,
and set as the “updatecli.io/track” label, so “–labels updatecli.io/track:major” selects them.
a track waits while an earlier track still has a pending update,
so a major update is proposed once no minor update is pending.
With “groupby: individual”, it waits for the same dependency.
With “groupby: all”, or in a group, the dependencies share one pull request per crawler,
so it waits for the whole pull request: one pending minor update holds back every major update of that crawler.
An update is pending while its pull request is open or, without an action, while its working branch exists.
Tracks are run in the order they are listed.
a track with “wait: false” never waits, but later tracks still wait for it.
the version filters of the tracks should not overlap, for example “minor” then “majoronly”.
Tracks setting only “age” share the crawler version filter, so they overlap:
with “allowdowngrade”, one track may undo the updates of another.
it isn’t supported by WASM plugins.
example:
tracks:
- name: minor
versionfilter:
kind: semver
pattern: minor
age:
minimum: 3d
- name: major
versionfilter:
kind: semver
pattern: majoronly
age:
minimum: 14d
- name: lts
wait: false
versionfilter:
kind: regex
pattern: '^1\.'
age
object
“age” defines the release age accepted by the track, as the crawler “age” does.
default:
the crawler default age.
remark:
it’s only accepted by crawlers supporting “age”.
allowdowngrade
boolean
“allowdowngrade” defines whether an update can lower the version in use.
default: false
remark:
by default, an update never lowers the version in use. While every newer
release is too recent, the update is skipped.
when set to true, an update lowers the version in use when it doesn’t match the
age filter, to the newest release that does.
it only applies with a “minimum” or “maximum” age.
maximum
string
“maximum” defines the maximum age a release may have to be considered.
remark:
accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years,
plus the Go duration units such as “h”, “m” and “s”.
a unit is required.
a month counts as 1/12 of a year and a year as 365 days.
example:
maximum: 6mo
maximum: 1y
minimum
string
“minimum” defines the minimum age a release must have to be considered.
remark:
accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years,
plus the Go duration units such as “h”, “m” and “s”.
a unit is required.
a month counts as 1/12 of a year and a year as 365 days.
example:
minimum: 24h
minimum: 7d
minimum: 3w
name
string
“name” identifies the track in the generated pipelines.
remark:
it must be unique, start with a letter or a digit, and only contain letters, digits, “.” and “-”.
versionfilter
object
“versionfilter” defines the version filter used by the track, as the crawler “versionfilter” does.
default:
the crawler default version filter.
kind
string
“kind” defines the versioning scheme used to select a version.
default:
latest
remark:
accepted values are “latest”, “semver”, “regex”, “regex/semver”, “time”, “regex/time”, “lex” and “pep440”.
“latest” returns the last version of the list.
“lex” sorts the versions lexicographically and returns the last one.
“pattern” defines the version pattern, according to “kind”.
default:
latest: “latest”
semver and pep440: “*”
regex: “.*”
time and regex/time: “2006-01-02”
remark:
for “latest”, “latest” returns the last version, any other value must match a version exactly.
for “semver” and “regex/semver”, it is a semantic versioning constraint.
for “pep440”, it is a pep440 version specifier.
for “regex”, it is a regular expression.
for “time” and “regex/time”, it is a Go date layout.
ignored by “lex”.
example:
pattern: ~1.2
pattern: “>=1.0.0 <2.0.0”
pattern: ^v\d+.\d+.\d+$
regex
string
“regex” defines the regular expression extracting the version from each entry.
remark:
only used by the kinds “regex/semver” and “regex/time”.
the value of the first capture group is used as the version.
example:
regex: ^v(\d+.\d+.\d+)$
replaceall
object
“replaceall” applies a regular expression replacement to each version before filtering.
remark:
only used by the kinds “regex”, “regex/semver” and “regex/time”.
the replacement runs before “pattern” or “regex” is evaluated.
example:
replaceall:
pattern: "_"
replacement: "."
turns “curl-8_15_0” into “curl-8.15.0”.
pattern
string
“pattern” defines the regular expression matching the text to replace.
example:
pattern: “_”
replacement
string
“replacement” defines the text replacing each match of “pattern”.
remark:
capture groups can be referenced with $1, $2, and so on.
example:
replacement: “.”
strict
boolean
“strict” enforces strict semantic versioning rules when parsing versions.
default:
false
remark:
only used by the kinds “semver” and “regex/semver”.
vulnerability
object
“vulnerability” switches the autodiscovery to security updates, based on the OSV database (https://osv.dev).
A Maven artifact is only updated when its current version has known vulnerabilities,
to the lowest version without any.
remark:
only security updates are generated, routine updates require a separate manifest.
it cannot be combined with:
“age”, as a fixed version is suggested as soon as it is known.
“versionfilter”, as the version is the lowest one without known vulnerabilities.
dependencies, managed dependencies and the parent pom are covered.
the current version is the version written in pom.xml. When it is a property, such as
“${log4j.version}”, defined in the same pom.xml, the property is updated instead.
Artifacts relying on a property defined elsewhere, or on a version range, such as “[1.0,2.0)”, are ignored.
several artifacts sharing a property each get their own manifest updating that property.
Once one manifest updates it, the others are skipped, and the next run checks the new version.
BOM imports are ignored, as OSV knows about the artifacts they manage, not the BOM itself.
labels, such as “security”, are set on the action used by the manifest.
example:
vulnerability:
minseverity: high
ignore:
- CVE-2021-44228
ignore
array
“ignore” defines the vulnerability IDs or aliases to disregard.