Boris Pavlović
Boris Pavlović

Reputation: 64640

How to run several classes in IntelliJ IDEA with same ordering?

Is there a way of telling IntelliJ IDEA Community Edition to run several classes in the same ordering one after another? Every class implements its own public static void main(String[]) method.

I would like to avoid jUnit since it doesn't guarantee the same ordering of execution, though its nice it can execute each test in its own JVM.

Upvotes: 0

Views: 143

Answers (2)

Igor Konoplyanko
Igor Konoplyanko

Reputation: 9374

You can write your own maven mini-project with this plugin attached:
http://mojo.codehaus.org/exec-maven-plugin/

And then you can in IntelliJ add run configuration on this maven project with your goal. I think this will be looking nice.

Upvotes: 1

Peter Lawrey
Peter Lawrey

Reputation: 533820

Do you mean like this?

// write a main which calls
A.main(args);
B.main(args);
C.main(args);

If they have to run concurrently, you can add them as tasks to a ExecutorService. You can trap exceptions so that if one dies, they all shut down.

Upvotes: 0

Related Questions