I have a project in NetBeans that starts with a main function, that takes arguments. When I hit the \"Stop\" Button, the project continues running, but there is no output anymor
When you hit "Stop" in the NetBeans output, NB stops the maven process, but maven had spawned the actual program output, so the stop command is not handed over to your program.
NetBeans calls the exec-maven-plugin with the 'exec' goal by default. If you change it to the 'java' goal there is no new process. After the change below, the 'Run' section in your projects 'Properties' will be empty and of no use. I did not test what happens if you call 'System.exit' or similar in this scenario.
Also note, that you have to take care that you modify the version number here by yourself from now on.
You have to go to Projects window, right click your project, go to the Properties
and select the Actions element and the the Run project entry. It will look like this:
You have to modify
process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:java
(change the exec
in the end to java
).
exec.mainClass=de.steamnet.stopfromnetbeans.Main
exec.classpath=%classpath
exec.args=First Second 'Third Space'
So that it looks like this:
From now on, Maven will not fork a new process, so when you hit "Stop" it will actually Stop the process.