Warm tip: This article is reproduced from stackoverflow.com, please click
java maven netbeans

How to run a maven project/main class in netbeans without building first?

发布于 2020-04-03 23:20:10

I have a maven project in the latest version of Netbeans but due to an undetermined problem with my environment/maven setup I have to build the project from the command line using gmake as building with mvn clean install comes up with a lot of errors.

So, I was wondering as I'm building from the command line, when using netbeans to run the project/main class, how can I just run it without it building/compiling first - i.e. every time I right click the main class and select run file - its will say - 'Building...' - can I just run the file without building/compiling?

Thanks!

Questioner
Rory
Viewed
59
Rory 2012-02-03 23:34

Not found a way to run this in Netbeans, but as a workaround am running the project from the command line using:

mvn exec:java -Dexec.mainClass="com.rory.djgx.server.Main"

Just need to ensure this is executed in the root directory of the compiled classes (.class), e.g. com/rory/djgx and that the pom.xml is in this root directory.