1

I am new to the spring framework. I have some experience in rails framework.

I am planing to create 3 environment ( test, dev, production )

I have created profiles in my pom file for each of this environment,

If i want to change the environment i have to manually change the active status as true / false.

Once i changed the environment, my entire app is running in that environment.

My question is,

"Is there any way to run the junit / TestNG test cases in test environment without changing anything in pom file?"

Thanks,

Jon

Jon
  • 2,703
  • 3
  • 18
  • 14

1 Answers1

0

If you use maven profiles you can trigger them in several ways. The easiest thing for you seems to explicitly specified the profile using the -P command line option.

mvn -P [test|dev|production]

Beside that, Spring 3.1 will introduce XML Profiles - this can be a good way how you can work with different environments. It should be released this year - although they have already a delay in releasing the RC1. Nevertheless I would give the Milestone release a try (I already did).

(Parts of this answer comes from here)

Community
  • 1
  • 1
FrVaBe
  • 47,963
  • 16
  • 124
  • 157
  • @Claszen, i haven't think about running the test in console. I am running the tests in eclipse only. Thanks for your suggession. But how we can achieve this in eclipse? – Jon Aug 24 '11 at 09:04
  • @Jon I am not sure if eclipse considers your pom.xml profile settings when running JUnit tests - but you can try open the eclipse project properties and select _Maven_ - If you are using m2e there is a "Active Maven Profiles" input box where you can set the profile. Maybe this also exists in the former m2eclipse plugin. – FrVaBe Aug 24 '11 at 11:45