-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 See my comments inline.
Cheers, john Vincent Massol wrote: | |>-----Original Message----- |>From: Jason van Zyl [mailto:[EMAIL PROTECTED] |>Sent: lundi 12 septembre 2005 06:56 |>To: Maven Developers List |>Subject: Re: Questions of profiles and settings... | | [snip] | * It seems that I need to put my project-specific profiles in a profiles.xml | file located in my project. So far so good. However, how can I trigger a | profile automatically? I could by having an activeProfile element in the | master settings.xml file but I don't want to do that as this activation is | only for this specific project so I want to contain everything related to | this project in the project's root dir. | | Here's a reminder of what I'd like to do (from the previous email): | - I have a property named ${cargo.containers} that has a default value set | up in a profile inlined in pom.xml | - I'd like that users of the build could specify an overridden value for | this cargo.containers property. The best place to do that is in a | profile.xml file in the project's root dir. | - I'd like their overridden value to be used when they type "m2 install" | without them having to type "m2 -Denv=myprofile install" which is too much | of a hassle IMO | If you want to, you can have a profile activated based on the presence or value of any system property. So, if you want the profile 'user-jdcasey' to be activated when I run the build, you might do something like this: <profile> ~ <id>user-jdcasey</id> ~ <activation> ~ <property> ~ <name>user.name</name> ~ <value>jdcasey</value> ~ </property> ~ </activation> ~ ... </profile> | * The http://maven.apache.org/maven2/profiles-overview.html document doesn't | mention the trick of naming a default profile "default" (as is described on | http://docs.codehaus.org/display/MAVEN/Build+Profiles). Does it mean it's | not implemented? Not entirely sure. It's been awhile since I implemented that stuff, I may have missed that detail. See below for why that may just fall by the wayside... | | Note: The reason I want this profile to be always on is because I want to | always have a default property for ${cargo.containers}. You might want to use a new feature to m2: POM-level properties. This is essentially the same capability you have with profiles, except it's built into the POM itself (sans profile). So, if you want to provide default values that can be overridden, you would probably want to use these. One side effect of POM-level properties is that you can pick and choose which configuration points you want to expose for plugin definitions that are inherited. For example, you might define a plugin in your parent POM, with configurations that have a common expression for part of their paths: <configuration> ~ <param1>${rootPath}/to/somewhere</param1> ~ <param2>${rootPath}/to/somewhere-else</param2> </configuration> Now, the user who extends this parent POM doesn't have to redeclare the plugin and reconfigure it, replicating the subdirectory structure...they can simply redefine ${rootPath}. This redefinition can be done via profile or via a child POM that has its own POM-level properties. | | * How do I tell m2 that the profile I have defined in the pom.xml file must | always be activated (I thought naming it "default" would work but apparently | not)? With POM-level properties you shouldn't really have to, but if you did, you might want something silly like this: <profile> ~ <id>always-on</id> ~ <activation> ~ <property> ~ <name>java.version</name> ~ </property> ~ </activation> ~ ... </profile> which will result in the profile being activated whenever the system property 'java.version' is defined, which should be always. It's a bit silly, but if you want system-dependent paths in your builds, you might do something like this in your settings.xml. Hmm, looks like we /could/ use a default profile for the settings.xml... ;) | | * The http://maven.apache.org/maven2/profiles-overview.html doc is quite | nice. It explains well what is dangerous with profiles and with an appserver | path property but it doesn't give a solution (or I haven't found it)... :-) | I think what I want to do by using a default value specified in an inlined | profile would do the trick but I can't find a solution to activate this | default profile... See if the above advice helps, and if not, let us know...we're going to be pretty busy fixing these types of things for the next few weeks. - -j | | Thanks | -Vincent | | | --------------------------------------------------------------------- | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFDJOdHK3h2CZwO/4URApMYAJwJ7a9cGsnMO7+pG94UgyCXLAvR3gCfZgMC +Q/glzaphw9edJcIs2CdIO4= =7beA -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]