Using relative path can have some surprises, so I would avoid it whenever possible. Especially on CI there is usually an (absolute) workspace path available.

Technically the JVM will transform a relative path into an absolute one by using the currents process working directory but "relative" might be surprising on some filesystems/os depending on how the string is passed to Java API.

Am 14.07.24 um 16:04 schrieb Romain Manni-Bucau:
Hi

Agree it should be absolute but there is no technical constraint -
ultimately it must be known how it resolves.

I know on ci it is common to use a relative path to avoid ci specific
internal path issues accross os/workers.

Le dim. 14 juil. 2024 à 09:52, Tamás Cservenák <ta...@cservenak.net> a
écrit :

Howdy

Yes, usually you do want it absolute.

The relative examples like "-Dmaven repo.local=../repo" you usually can
find in some examples or reproducers.

If local repo path relative, these will end up using different local
repositories (imagine some multi module build):

$ mvn install
$ mvn -f submodule1/pom.xml install
$ cd submodule2 && mvn install

As it is evaluated at maven boot and relative would be calculated against
CWD based on invocation (plus, -f modifies it).

Hth
T

On Sun, Jul 14, 2024, 03:10 Timothy Stone <tst...@petmystone.com> wrote:

I help maintain Maven tooling for To Be Continuous, a GitLab CI/CD
catalog of pluggable pipeline configurations.

There is some discussion on the use of the JVM property,
`-Dmaven.repo.local=path' and the note on "Configuring your Local
Repository" (see [1]). Initially I was going to post to the user list,
but being a development question against the internals of Maven, I
thought this a better forum.

There is an admonition on the referenced page:

/Note: The local repository _must_ be an absolute path./ (emphasis mine)

Is this specifically noted for the use of the settings.localRepository
only or does the note extend to the use of the JVM property? I searched
the GitHub repo for a examples and found numerous uses of relative
paths, e.g., `../.repository` and others.

Seeking clarification as I could not immediately determine the internal
use of `maven.repo.local' property when set.

Thanks!
Tim


[1]


https://maven.apache.org/guides/mini/guide-configuring-maven.html#configuring-your-local-repository
--
Timothy Stone
=============
Some call me ... Tim.
Husband, Father, Blogger, OSS, Wargamer, Home Brewer, and D&D
Find me on GitLab | GitHub | Linked In | MeWe | GnuPG




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to