pankaj_ar
pankaj_ar

Reputation: 765

more than 1 main() methods in a software. Is this due to Maven plug-in?

I am in a company and I hv seen source code of one of its software. I found more than 25 occurrences of main() method in that. I analysed some features of myeclipse and found one solution that this is due to maven that is installed in eclipse, which allows u to prepare more than 1 build files for a software.

I want to know, is my analysis true?

Thanks in advance...

Upvotes: 0

Views: 62

Answers (1)

JB Nizet
JB Nizet

Reputation: 691665

No, your analysis is not true. Any class may have a main method. Just add the method to the class, and it'll be there. The fact the Maven, Eclipse, or MyEclipse is used is irrelevant. Developers have chosen to add a main method in all thoses classes, that's all.

There are pretty good reasons to have several main classes in a jar. For example, if the jar contains a collection of utilities.

Upvotes: 4

Related Questions