How to achieve deployment while saving a multi-module Maven project in NetBeans?

I have a multi-module Maven project in NetBeans with the following structure on the file system.

.
| MyProject/
β”œβ”€β”€ web-module/
|   β”œβ”€β”€ src/
|   └── pom.xml
β”œβ”€β”€ core-module/
|   β”œβ”€β”€ src/
|   └── pom.xml
└── pom.xml

      

I set Compile on Save on all modules and Deploy on Save in the web module, and now when I change something in the web module it is automatically compiled and deployed, but it doesn't work for changes in the main module. I also created a new project group (files / project groups ... / Projects and all required projects) and set the parent project there, but it also doesn't work.

My questions:

  • Is it possible at all to achieve what I want in NetBeans, and if yess, how?
  • Deploy on Save in NB seems to restart Tomcat which is not an efficient solution (Spring context load time) - can something like "jvm hot swap" be used, namely when I made some changes (I mean changes inside the method without changing the class structure), I would like to see this immediately without restarting Tomcat.

I am using NetBeans 8, Maven built in NB and Tomcat 6

PS. I know what I want to achieve, this is not rocket science, I was able to configure Eclipse this way and everything worked decently (without installing any additional plugins).

PPS. Yes, I've heard about JRebel, but it's not free.

+3


source to share


1 answer


Check the Java debugger settings, you should activate "Apply code changes after saving".

enter image description here

This will allow you to update the classes without restarts, but is limited to body tags only.



Please note that several posts reported this feature in NetBeans, I don't know if this issue has been resolved or not.

EDIT: Disable "Deploy on Save" via project properties -> Run tab.

0


source







All Articles