You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Maven User <ma...@gmail.com> on 2011/07/08 21:50:22 UTC
Mirrors and repositories
Hi all -
I thought I had a good handle on this, but can someone help me fully
understand the <mirrors> and <repositories> settings in settings.xml?
When one has a repository server running, and there are several urls grouped
up, why isn't it enough to tell maven where to look via a single mirrors
stanza?
Why do I then also have to define an additional repository?
For example, if I have:
<mirrors>
<mirror>
<id>full</id>
<name>Public repository</name>
<url>http://nexus.is.awesome/nexus/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
Why do I also need to do this:
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>snapshots</id>
<name>Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>
http://nexus.is.awesome/nexus/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
......
I'd have thought that the mirror stanza above would have pointed maven to
this grouped up url for ALL artifact resolution.
Re: Mirrors and repositories
Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Jul 8, 2011 at 4:09 PM, Maven User <ma...@gmail.com> wrote:
> When I was building without the additional repository defined, maven (maven
> 3.0.3) was unable to find the parent pom. Once I added this extra
> repository, boom - it all works.
It worked because you had <snapshots><enabled>true somewhere.
> What's extra confusing is I have <mirrorOf>*</mirrorOf> - shouldn't that say
> "this url is a mirror of EVERYTHING?
That means it'll be a mirror for any repository defined in
settings.xml or pom.xml. If none of those repos have snapshots
enabled, Maven won't download any snapshots.
> But I'm not saying I'm mirroring JUST central, I thought I was saying "I'm
> mirroring every repository you could possibly need".
> See my comment about the <mirrorOf>*</mirrorOf>.
No, it just means, "When you go through your list of known
repositories, substitute this url instead of the original one
defined."
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mirrors and repositories
Posted by Maven User <ma...@gmail.com>.
Ahhh - here we go -
So I'm working on rolling out a corp pom for a company who doesn't have one
right now.
The corp pom is a completely different maven project/jenkins build and
structurally, unrelated to the other projects that list it as a parent.
The current version of this corp pom is 1.0-SNAPSHOT and it's deployed to my
snapshot repository within Nexus.
The grouped up repository in Nexus includes this snapshot.
When I was building without the additional repository defined, maven (maven
3.0.3) was unable to find the parent pom. Once I added this extra
repository, boom - it all works.
What's extra confusing is I have <mirrorOf>*</mirrorOf> - shouldn't that say
"this url is a mirror of EVERYTHING?
I'm basing this all on this link:
http://maven.apache.org/guides/mini/guide-mirror-settings.html
(thank you Wendy!)
On Fri, Jul 8, 2011 at 3:58 PM, Wendy Smoak <ws...@gmail.com> wrote:
>
> What happens when you don't? Knowing why you think you need to do it
> would help someone explain it.
>
> One reason you might do it is to enable a repository to be searched
> for snapshots. By default, Maven's built-in definition of 'central'
> only has releases enabled. Unless you define another repository
> somewhere that has snapshots enabled, Maven will never retrieve any
> snapshots.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Mirrors and repositories
Posted by Maven User <ma...@gmail.com>.
Snapshots of plugins are explicitly banned as are not specifying versions of
plugins and relying on maven's super pom (years ago, I got whacked with this
when the war plugin changed).
But I'm not saying I'm mirroring JUST central, I thought I was saying "I'm
mirroring every repository you could possibly need".
See my comment about the <mirrorOf>*</mirrorOf>.
On Fri, Jul 8, 2011 at 4:10 PM, Brian Fox <br...@infinity.nu> wrote:
> > One reason you might do it is to enable a repository to be searched
> > for snapshots. By default, Maven's built-in definition of 'central'
> > only has releases enabled. Unless you define another repository
> > somewhere that has snapshots enabled, Maven will never retrieve any
> > snapshots.
>
>
> This is exactly why ^^
>
> You need to do the same for pluginRepositories if you ever want to get
> snapshots of plugins.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Mirrors and repositories
Posted by Brian Fox <br...@infinity.nu>.
> One reason you might do it is to enable a repository to be searched
> for snapshots. By default, Maven's built-in definition of 'central'
> only has releases enabled. Unless you define another repository
> somewhere that has snapshots enabled, Maven will never retrieve any
> snapshots.
This is exactly why ^^
You need to do the same for pluginRepositories if you ever want to get
snapshots of plugins.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mirrors and repositories
Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Jul 8, 2011 at 3:50 PM, Maven User <ma...@gmail.com> wrote:
> I thought I had a good handle on this, but can someone help me fully
> understand the <mirrors> and <repositories> settings in settings.xml?
>
> When one has a repository server running, and there are several urls grouped
> up, why isn't it enough to tell maven where to look via a single mirrors
> stanza?
>
> Why do I then also have to define an additional repository?
What happens when you don't? Knowing why you think you need to do it
would help someone explain it.
One reason you might do it is to enable a repository to be searched
for snapshots. By default, Maven's built-in definition of 'central'
only has releases enabled. Unless you define another repository
somewhere that has snapshots enabled, Maven will never retrieve any
snapshots.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org