I have a main class that takes a series of arguments and I have 10 run configurations. Is there a way to have eclipse run them one after another?
-
Create a batch file that runs your software with each of the different run configurations?Rob Wagner– Rob Wagner2012年07月09日 20:50:16 +00:00Commented Jul 9, 2012 at 20:50
-
1Write an ant/maven script to run the program the way you want or modify the scripts you already have on your project.toniedzwiedz– toniedzwiedz2012年07月09日 20:52:15 +00:00Commented Jul 9, 2012 at 20:52
-
2Tom is right, ANT is a good way to go, see for example heres106mo– s106mo2012年07月09日 20:54:39 +00:00Commented Jul 9, 2012 at 20:54
-
I thought ant was for building applications? For reasons to long to explain I can't export the project to a runnable jar and I need to run it through eclipse. So I click each run config and wait till it is done, then click the next...Steven Feldman– Steven Feldman2012年07月09日 20:57:16 +00:00Commented Jul 9, 2012 at 20:57
-
@StevenFeldman both ant and maven allow you to execute tasks/goals defined in your scripts. They can be as complex as compiling the entire project, running a set of unit and integration tests, deploying the application to production, testing again and then pushing it to version control. Eclipse lets you execute them goals in a couple of clicks as well. It's not a problem to define a task/goal of running an application ten times with different settings in either of these technologies.toniedzwiedz– toniedzwiedz2012年07月09日 21:01:50 +00:00Commented Jul 9, 2012 at 21:01
3 Answers 3
The other answers are probably better solutions to your problem. However, if you install the Eclipse CDT into your Eclipse installation (using update manager or market place client), then you get an additional launch configuration type called Launch group.
Those launch groups allow creating a list of other launch configurations to be run one after the other. Make sure to set the Post build action in the dialog to "Wait until terminates" for each included launch configuration.
Comments
@Steven: To do it quick, you can write a JUnit Test case that just calls the intended classes in desired order and execute it. Eclipse already has the necessary jar for JUnit, so you are ready to go. Definitely, writing ANT/MAVEN script is a good practice.
Comments
As @gotuskar suggested, write test cases for your class. If you can afford running your ten configurations each time you build your project put them in its src/test/java directory, otherwise create a sibling project to your original one, make it depend on it, and put your tests there.