On Fri, 19 May 2006, Max Cooper wrote: > I have maven.test.skip set to true in my settings.xml. The tests are > still skipped when I run 'mvn -Dmaven.test.skip=false install'. Is this > a bug or is it intentional?
After examining the code it seems that it's a bug. The code in MavenCli states that 'System properties are most dominant'. However, the PluginParameterExpressionEvaluator tries the system properties as a final resort. Since this is used everywhere in Maven changing this will have a huge impact. I wouldn't count on it to be fixed soon, but you should file a JIRA issue for this anyway. In trying to find a workaround I found another 'bug': if you add a second profile, not activated by default, say 'blah2', with the maven.test.skip property set to false, then you should be able to specify -Pblah2 to reset that property to false. However, this currently doesn't work either. But I've fixed that in svn, so this workaround should work for 2.0.5. (see MNG-2309). For now, I suggest the following workaround: define a profile that activates if a certain system property X is NOT set. That profile defines maven.test.skip=true. If you specify -DX=.. then that profile is NOT activated and maven.test.skip will be it's default value: false. X could ofcourse be defined as 'maven.test.skip'. -- Kenney > > > SAME QUESTION, MORE DETAIL: > =========================== > I have maven.test.skip set to true in my ~/.m2/settings.xml file. I did > it like this: > > <settings> > <profiles> > <profile> > <id>blah</id> > <properties> > <maven.test.skip>true</maven.test.skip> > </properties> > </profile> > </profiles> > <activeProfiles> > <activeProfile>blah</activeProfile> > </activeProfiles> > </settings> > > Sometimes, I would like to set it to false, overriding the setting from > my profile. I would like to do this on the command line, like so: > > mvn -Dmaven.test.skip=false install > > However, my setting on the command line seems to be ignored. The tests > are still skipped, even if I set maven.test.skip=false in this manner. I > find this behavior to be surprising. I would expect the value I > expressed on the command line to override any settings from pom.xml or > settings.xml. > > So I wondered if perhaps the surefire plugin was ignoring the value of > the property and just checking if the property was set or not. In other > words, I wondered if setting maven.test.skip to 'false' (or 'carrots', > or anything) would have the same effect as setting it to true. To test, > I removed maven.test.skip from my settings.xml file and set the value on > the command line. I found that surefire does indeed pay attention to the > value. Setting maven.test.skip=true would skip the tests, but setting > maven.test.skip=false would not skip the tests. > > So it seems that the value in my settings.xml file cannot be overridden > on the command line. Is this a bug, or is this intentional? If it is > intentional, why? It seems to me that property values specified > explicitly on the command line should override any property values from > pom.xml or settings.xml files. > > Thanks, > -Max > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Kenney Westerhof http://www.neonics.com GPG public key: http://www.gods.nl/~forge/kenneyw.key --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
