Mykel,
I am glad you posted your experience!
I tried an empty <activeByDefault/> the same way you did and assumed
that it didn't work.
I ended up listing the profile I wanted active in <activeProfiles>. And
then setup an example settings.xml for the rest of my team to active the
profile this way. So now my whole team is missing out on the simpler
<activeByDefault> tag.
If I had only known... :-)
-Max
Mykel Alvis wrote:
> 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 http://foo.com:9999/repository
> b) a non-proxied m1 repo that I use to acquire some artifacts from
> java.net(
> https://maven-repository.dev.java.net/nonav/repository/ )
>
> maven-proxy doesn't like to deal with the java.net 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:
>
> <settings>
> <mirrors>
> <mirror>
> <id>proxy</id>
> <name>Maven Mirror Managed by maven-proxy</name>
> <url>http://foo.com:9999/repository</url>
> <mirrorOf>central</mirrorOf>
> </mirror>
> </mirrors>
> <servers>
> <server>
> <id>local</id>
> <username>maven</username>
> <privateKey>/home/malvis/.ssh/id_rsa</privateKey>
> <passphrase>thisisthepassphraseformykey</passphrase>
> </server>
> <server>
> <id>local-ftp</id>
> <username>maven</username>
> <password>maven</password>
> <filePermissions>666</filePermissions>
> <directoryPermissions>777</directoryPermissions>
> </server>
> <server>
> <id>site-local</id>
> <username>maven</username>
> <password>maven</password>
> <filePermissions>666</filePermissions>
> <directoryPermissions>777</directoryPermissions>
> </server>
> </servers>
> <profiles>
> <profile>
> <activation>
> <activeByDefault />
> </activation>
> <repositories>
> <repository>
> <id>java.net</id>
> <url>
> https://maven-repository.dev.java.net/nonav/repository</url>
> <layout>legacy</layout>
> </repository>
> </repositories>
> </profile>
> </profiles>
> </settings>
>
>
> The java.net 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 "java.net".
>
> The odd part was that the build DOES pick up the fact that "central" is
> mirrored at the "foo.com" maven-proxy but not that it should include the "
> java.net" 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
> chastised.
>
> 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. :)
>
> Mykel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
|