scyjava
scyjava copied to clipboard
scyjava does not agree with jgo on default m2 repo path
As reported downstream in PyImageJ, scyjava sets the m2_repo
to ~/.m2/repository
by default. Although you can override it using scyjava.config.set_m2_repo
, the upstream jgo library has a function jgo.m2_path
which does as follows:
def m2_path():
return os.getenv("M2_REPO", (pathlib.Path.home() / ".m2").absolute())
In other words: it looks also at the M2_REPO
environment variable, before falling back to ~/.m2
.
This behavior in jgo is actually wrong because M2_REPO
is supposed to point to the actual local Maven repository cache directory e.g. ~/.m2/repository
, not the parent ~/.m2
. So a fix is needed in jgo; see also scijava/jgo#99 which covers essentially the same issue for M2_HOME
. Probably the m2_path
function should be deprecated in favor of two functions m2_home
and m2_repo
instead.
And then what scyjava should do is ask jgo—once jgo yields the correct answer—what its default should be, so that it matches.