Wrong :-) Let me try to explain ... Your approach to allow to override this parameter using a property is good. I'm doing it to validate a new version of my repository manager and so on. But how you are doing it is wrong. You should avoid to use a profile with activeByDefault activation. Why ? Because unlike its name could make you think, by default isn't always activated but only if no other profile is used. Thus as soon as you'll use another profile (for a release, a ci server, ...) this one won't be here, your property won't be set, and your deployment will fail. The recommended solution is to define a default value in the property of you pom outside of any profile. This one will be the real default. You'll have it in any case except if you override the value : - with a property set in a profile activated in the project - with a property set in a profile activated in your user settings - with a property set in the command line (-D) You can find a sample of that in my corporate pom : http://svn.exoplatform.org/projects/parent/trunk/pom.xml You'll notice I'm using a lot of properties to allow users/projects to easily override settings they want to change without having to wrige a large block of xml settings.
Arnaud Héritier Software Factory Manager http://www.exoplatform.com Phone : +33 (0)6 89 74 64 24 Skype : aheritier Twitter : @aheritier Blog : http://aheritier.net On Oct 4, 2010, at 9:04 PM, Phillip Hellewell wrote: > On Mon, Oct 4, 2010 at 12:43 PM, Phillip Hellewell <ssh...@gmail.com> wrote: >> On Mon, Oct 4, 2010 at 12:31 PM, Anders Hammar <and...@hammar.net> wrote: >>> Are you seeing the pattern yet? Don't fight Maven! >> >> Hehe, yeah I am. But using a parent pom for this setting is still not >> making complete sense to me, so I've got to play with it some more and >> hopefully it will. > > Ok, I figured out what I feel is a valid and good solution. Not sure > why I didn't think of this before, but in the default profile in my > settings.xml I can simply define a property called "repos.url", right > where I define my repository. Then I can use that same property in my > distributionManagement section in any of my poms that I want to. > > So something like this goes in my settings.xml: > <profiles> > <profile> > <id>default</id> > <activation> > <activeByDefault>true</activeByDefault> > </activation> > <properties> > <repos.url>file:///c:/test123</repos.url> > </properties> > <repositories> > <repository> > <id>test123</id> > <name>test</name> > <url>${repos.url}</url> > </repository> > </repositories> > </profile> > </profiles> > > And something like this goes in my pom files: > <distributionManagement> > <repository> > <id>myrepos</id> > <url>${repos.url}</url> > </repository> > </distributionManagement> > > The other advantage here is that I can pass in repos.url on the > command-line with -D if I want to deploy to another repository. > > I hope you won't tell me this is the "wrong" way, because it seems > like a perfectly valid approach to me. > > Phillip > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org