Hi,

Adding the main class in MANIFEST.MF is not good enough to run a Maven project with "java -jar". You also want to create a "fat jar" with all the dependencies in it. See [1] for guidance.

> Is there a reason why Netbeans doesn't do it?

Here're some possible answers (of my own, doesn't mean NetBeans endorses them):

a) I don't like my IDE to mess around with my pom.xml files but for very specific things (adding dependencies, for instance).
b) This is something users are expected to do.
c) This is project-specific. Maven based Spring-Boot projects, for instance, have a main class of their own. NetBeans Platform based projects do also have a main class of their own.
d) Nobody has created a PR for this feature.

Hope this helps,
Antonio

[1]
https://www.baeldung.com/executable-jar-with-maven


El 16/2/22 a las 11:43, Vladimir Machat escribió:
Hi all,

I was just wondering, is Netbeans supposed to fill out the main attribute in MANIFEST.MF that goes to the jar file, when building Maven project?

At the moment it doesn't do it, which means that the resulting jar can't be executed just by

$ java -jar App.jar

I would expect Netbeans to set the main attribute when setting the main class either in the Project properties or when it asks you the very fist time you run the application in the IDE.

Is there a reason why Netbeans doesn't do it?

Thanks

Vlad


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to