I would like to use Vagrant (See here) together with VirtualBox in order to set up a java development environment to work on webapps (*.war archives for that matter).
I would have Eclipse installed on the host and MySql on the guest (that's pretty straightforward so far) but I want to have Tomcat run on the guest too and that where it is getting more difficult.
My questions are:
Is all of this really feasible with Vagrant?
EDIT 1: Here is a screen capture of my Eclipse's Tomcat:
What files/folders am I supposed to share? (not the whole eclipse workspace I suppose)
IMHO, share the project you are working on
is enough. This way you may have one VM for each project.
You have two options to generate the war:
If you choose Option 1
: Since your project folder is shared with VM, you can copy the war to $CATALINA_HOME/webapps
once you ssh to VM.
I would suggest Option 2
because you could keep the build environment as close to your production environment as possible.
Am I better off using a exploded or a normal war archive?
I would use normal war archive, but there's not much difference here.
How do I configure Eclipse (which lives on the host) to see the remote Tomcat (the one that lives on the guest).
You have two options here:
How to configure Host-Only Networks
config.vm.network "hostonly", "192.168.0.0"
Have this line in your Vagrantfile
will instruct vagrant to create a private network that has a static IP address: 192.168.0.0
The IP address of the host is always the same IP address but with the final octet as a 1. In the preceding example, the host machine would have the IP address 192.168.0.1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With