[ImageJ-devel] Speeding up Maven downloads using the ImageJ public mirror
Johannes Schindelin
schindelin at wisc.edu
Wed Jan 15 11:35:11 CST 2014
Hi Curtis,
I got curious about the "remote proxy" feature of Nexus (which is used to
serve ImageJ's Maven repository). For the benefit of other developers, let
me write it up here:
When clicking on the "Repositories" link on the left hand side menu of
http://maven.imagej.net/ you see a lot of repositories with basically
four types: "group", "hosted", "virtual" and "proxy":
http://maven.imagej.net/index.html#view-repositories
The "hosted" ones are our repositories, to which we deploy: snapshots,
releases and thirdparty (for dependencies we rely on that were not
deployed anywhere yet).
The "virtual" repositories are there only for compatibility and we could
even switch them off because we do not support Maven 1 at all.
The proxy repositories are interesting: when accessing them via Maven,
they try to retrieve the desired artifacts from remote repositories and
keep cached copies (eternally for release versions, 24 minutes for
snapshots) so that they serve the artifacts from the cache until expired.
The groups are just aggregating others, and the most important group is
the "public" one: it offers a single, public-facing repository that serves
*all* of the public repositories, including the proxy ones.
Now, the real cool thing about it is that you can configure your local
Maven to use the "public" group repository as a *mirror*, i.e. instead of
looking here and there and everywhere for artifacts, it looks only at the
"public" repository and lets that one worry about retrieving the
artifacts. It also makes things faster because Maven will only have to
look at one single repository rather than trying a couple of them.
To configure the mirror, I added the <mirrors> section to my
$HOME/.m2/settings.xml:
-- snip --
<settings>
...
<mirrors>
<mirror>
<id>imagej-mirror</id>
<name>ImageJ's public mirror repository</name>
<url>http://maven.imagej.net/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
...
</settings>
-- snap --
It is a pity that we cannot configure the mirror from the pom-scijava
parent (which would have relieved every developer from having to configure
the *exact* *same* thing on their computers), but at least it is easy
enough.
Maybe we should teach the imagej-maven-plugin to edit the user's
configuration when the user asks for it?
Ciao,
Dscho
More information about the ImageJ-devel
mailing list