maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mykel Alvis" <>
Subject settings.xml activation activeByDefault setting
Date Wed, 19 Jul 2006 23:59:36 GMT
Prepare to laugh at me, because today is my day for discovering that the sky
is blue.  I recently discovered something that most people almost certainly
know but hasn't been clear to me for the last 12 months until about 10
minutes ago.

I thought I kept hearing that I can specify repositories in my
settings.xmlfile and make those the repos I use with all my builds,
but this never seems
to work for me and wanted to work out why.

In my installation, I have
a) a maven-proxy to "central" that handles all of my maven2 dependencies
hosted at
b) a non-proxied m1 repo that I use to acquire some artifacts from )

maven-proxy doesn't like to deal with the repo for some reason,
calling it an unknown upstream repository type, so it's necessary to add
another repository to my <repositories> in order to get those dependencies.

I thought the following settings.xml would work:

            <name>Maven Mirror Managed by maven-proxy</name>
                <activeByDefault />

The repository was not picked up by builds.  The builds that fail
specify a parent pom which specifies no <repositories> itself.
I thought, perhaps incorrectly, that by specifying a <repository> in a
<profile> that was <activeByDefault> would make my build pick up that
profile and all it's <repositories> which I thought would include the
mirrored "central" as well as "".

The odd part was that the build DOES pick up the fact that "central" is
mirrored at the "" maven-proxy but not that it should include the "" repo in it's list of repositories to try.

Well, if I gave the profile a name and specified it on the command line the
whole thing worked.  But why not when I didn't specify the profile?  It was,
after all, <activeByDefault/>

Now, here comes the "I'm slow" punchline.
<activeByDefault/> is not a self-contained tag, but rather a boolean
setting.  Well, duh!  I KNEW this somewhere in the down in sub-coccal
region, but it slipped by me the whole time.  Instead of <activeByDefault/>,
which I incorrectly thought was the means to get a profile automatically
activated, one must <activeByDefault>true</activeByDefault>

Why did I think this?  Two reasons, I guess, and not very good ones.
One, I've seen very few working examples of someone elses's "real"
settings.xml.  After all, there are passwords and stuff in there and we're
not supposed to post that sort of thing on the net.
Two, because in the settings.xml reference, it's listed as a self-contained
tag and I just copied it out of the reference.  That's right!  I'm a
cut-and-paste junkie.  Turns out the reference is NOT anything of an
example.  At some point I scrolled down and noticed that it was listed as a
"flag" and even at my very slowest I can usually recognize that as an
explicit boolean.  And I've worked with practically every other tag that's
listed as a closed tag but actually contains a value.  But
<activeByDefault/> clearly slipped by my aging neurons.

Once I'd figured this out, I went back to Better Builds, searched for
"activeByDefault", saw an example of it's proper use (p.106 in case you felt
like pointing and laughing early), and was so embarassed that I felt the
need to post it here, receive the derision of my peers, and thus be properly

OK.  Everyone throw rocks and mud at me now.  I'll eventually live down the
shame, but I didn't want anyone else to have to endure it in case they had
the same breakdown in thinking that I experienced. :)


Never wear anything that panics the cat. -- P. J. O'Rourke

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message