OK, so flip the assumptions I made in my earlier profile. Then, you could change the profile to "skip-tests" and the reverse would happen. Change the name of the profile to "sandbox". Now, when you do "mvn -Psandbox install" you'll get no tests, but a regular "mvn install" would include all your tests.
It may require another profile to handle your second condition. The notion that a single profile can somehow read your mind and know whether it should or should not run "certain" tests just won't fly. That'll require an extra profile added to your build. So, you might end up with a build command line that looks like... mvn -Psandbox,no-externals install Otherwise, the same semantics in your pom.xml apply. It's just a matter of setting up a default condition that you can override in your profile. Dave Yaakov Chaikin wrote: > Well, the thing is that I have a couple of requirements: > > 1) When doing mvn install all tests should run (without specifying a profile) > 2) When doing mvn install -DskipTests=true, no tests should run > 3) When doing mvn install -P sandbox, no tests should run > 4) When doing mvn install -P sandbox, only some of the modules should > run their tests (the ones that don't hit any outside resources like a > DB). > > How would I do that? > > Thanks for your help! > > Yaakov. > > On Thu, Nov 12, 2009 at 5:49 PM, David C. Hicks <[email protected]> wrote: > >> I generally use a Profile when I want to do something of this nature. >> So, for your case, you might have something like... >> >> <properties> >> � �<skipTests>true</skipTests> >> </properties> >> >> <profiles> >> � �<profile> >> � � � <id>run-tests</id> >> � � � <properties> >> � � � � �<skipTests>false</skipTests> >> � � � </properties> >> � �</profile> >> </profiles> >> >> Then by simply calling Maven with the profile activated, you can run the >> tests... >> >> mvn -Prun-tests clean install >> >> >> Yaakov Chaikin wrote: >> >>> Right... I figured that... But why? Isn't something on the >>> command-line supposed to trump it all? >>> >>> Any suggestions on how to correct this? >>> >>> Thanks, >>> Yaakov. >>> >>> >>> On Thu, Nov 12, 2009 at 5:23 PM, David C. Hicks <[email protected]> wrote: >>> >>> >>>> I think it's an order-of-evaluation problem. �I suspect that your >>>> -DskipTests=true is getting overridden by the <property> in your pom.xml. >>>> >>>> Yaakov Chaikin wrote: >>>> >>>> >>>>> Ok, >>>>> >>>>> Checked documentation, googled. Still not understanding why the >>>>> following is happening. >>>>> >>>>> I have a multi-module project. In the root pom.xml, I have: >>>>> <properties> >>>>> � <skipTests>true</skipTests> >>>>> <properties> >>>>> >>>>> >>>>> In my child pom.xml I have the following: >>>>> >>>>> <properties> >>>>> � �<skipTests>${skipSelfContainingTests}</skipTests> >>>>> <properties> >>>>> >>>>> In my settings.xml, I have this: >>>>> <properties> >>>>> � <skipSelfContainingTests>false</skipSelfContainingTests> >>>>> </properties> >>>>> >>>>> When I do mvn help:effective-pom on the child module, it does show >>>>> that my skipTests=false. However, when I do mvn help:effective-pom >>>>> -DskipTests=true, the effective pom STILL shows up with >>>>> skipTests=false! >>>>> >>>>> What am I doing wrong here? >>>>> >>>>> Thanks, >>>>> Yaakov. >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>>> >>>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>>> >>>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
