You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Phillip Hellewell <ss...@gmail.com> on 2010/12/06 20:38:00 UTC

Dumb question about mirrors and repositories

For some reason I was under the impression that if I had a mirrorOf *
defined in my settings.xml, I didn't need to have any <repositories>
defined.

  <mirrors>
    <mirror>
      <id>all-mirror</id>
      <name>Mirror of Everything</name>
      <url>http://maven.example.com:8080/nexus/content/groups/public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>

It's been working just great up until now when I tried to depend on a
snapshot that is only in the remote repo.  It wouldn't find it, but
after I added an appropriate <repositories> section, it does:

  <profiles>
    <profile>
      <id>default-repo</id>
      <repositories>
        <repository>
          <id>adrepo-public</id>
          <url>http://maven.example.com:8080/nexus/content/groups/public</url>
          <snapshots><enabled>true</enabled></snapshots>
          <releases><enabled>true</enabled></releases>
        </repository>
      </repositories>
    </profile>
  <profiles>
  <activeProfiles>
    <activeProfile>default-repo</activeProfile>
  </activeProfiles>

So now I'm really curious.  Should it actually be working with just
the mirror, and if not, why not exactly?  Why should releases work
with the mirror but not snapshots?  And if I need to use
<repositories> anyways, should I get rid of the mirror?  (I'm thinking
no, since I really want to ensure it is always used over just using
Maven central directly).

Thanks,
Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Dumb question about mirrors and repositories

Posted by Phillip Hellewell <ss...@gmail.com>.
On Mon, Dec 6, 2010 at 2:06 PM, Justin Edelson <ju...@justinedelson.com> wrote:
>
> Because by default, Maven only has central configured as a repository and
> that's only configured for release artifacts, not snapshots.

Thanks!  That explains it perfectly.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Dumb question about mirrors and repositories

Posted by Justin Edelson <ju...@justinedelson.com>.
On Mon, Dec 6, 2010 at 3:15 PM, Phillip Hellewell <ss...@gmail.com> wrote:

> On Mon, Dec 6, 2010 at 12:55 PM, Hilco Wijbenga
> <hi...@gmail.com> wrote:
> >
> > You need to add something like the following to your settings.xml to
> > "enable" snapshots.
> >
> > ...
>
> Thanks, but if you look closely at my email you'll see I already
> figured that out.  All I'm interesting in now is gaining some more
> understanding about mirrors versus repositories to understand why
> things work the way they do.
>
> Phillip
>

Because by default, Maven only has central configured as a repository and
that's only configured for release artifacts, not snapshots.

Justin


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Dumb question about mirrors and repositories

Posted by Phillip Hellewell <ss...@gmail.com>.
On Mon, Dec 6, 2010 at 12:55 PM, Hilco Wijbenga
<hi...@gmail.com> wrote:
>
> You need to add something like the following to your settings.xml to
> "enable" snapshots.
>
> ...

Thanks, but if you look closely at my email you'll see I already
figured that out.  All I'm interesting in now is gaining some more
understanding about mirrors versus repositories to understand why
things work the way they do.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Dumb question about mirrors and repositories

Posted by Hilco Wijbenga <hi...@gmail.com>.
On 6 December 2010 11:38, Phillip Hellewell <ss...@gmail.com> wrote:
> For some reason I was under the impression that if I had a mirrorOf *
> defined in my settings.xml, I didn't need to have any <repositories>
> defined.
:
<snip/>
:
> So now I'm really curious.  Should it actually be working with just
> the mirror, and if not, why not exactly?  Why should releases work
> with the mirror but not snapshots?  And if I need to use
> <repositories> anyways, should I get rid of the mirror?  (I'm thinking
> no, since I really want to ensure it is always used over just using
> Maven central directly).

You need to add something like the following to your settings.xml to
"enable" snapshots.

<profile>
  <id>SnapshotsOkay</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <repositories>
    <repository>
      <id>central</id>
      <url>http://central</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://central</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org