Here’s the question: When using Vagrant for a Java project (or any compiled language project for that matter), should you compile in the VM or on the host? Also, would you want your IDE and all your development tools to be run from inside the VM as well, or on the host?
It seems to be not very well defined exactly how a Java IDE and the compile/deploy process work with a Vagrant VM. Generally my impression is that code is edited on the host, and run on the VM, which works great for non-compiled languages. Other answers on Stackoverflow have implied that Vagrant is less useful for compiled languages because of the extra compile step, but I still want to see what can be done.
Some things I’ve thought through already:
Why compile on the VM
- if compiling on host, java is one more piece of software to install
- if compiling on host, the java version on host must be manually kept up to date with that on the VM
- the corresponding java version on the host might be unavailable (say, on a Mac)
Why have IDE on the VM
- tighter integration between environment and IDE, can use shortcuts to run the application
- can connect debugger for java applications without remote debugging (one step run/debug)
Why compile on the host
- faster compile times
- want to keep the VM as close to what production looks like as possible
Why have IDE on the host
- it’s the vagrant convention to edit code on the host and run it on the VM
- better UI performance (X forwarding and VNC are slow)
What are your thoughts: should I run my IDE from inside the VM or the host? Should I compile from inside the VM or the host?