When working with java/javaee usual development environment setup is to have everything locally (jdk installation, database, appserver etc). I know a lot of people in ruby/js world use virtual machines for development (mainly with vagrant).
I wonder if there is an efficient way to set up similar env for java/javaee.
I suspect that I can easily install database server and application server together with jdk version on such virtual machine, but what about regular development? I still need to have jdk installed locally, right? (I need my IDE to work properly) I need maven to build my project, so that I need full maven local repo. And then I need to deploy my app on virtual machine's app server.
I can see no real advantage here (still having pieces of environment on both machines).
Do you have any experience with that and can share with me?
解决方案
Vagrant is basically a tool for setting up a VirtualBox virtual machine. It brings to the table the ability to quickly provision a VM and the ability to pass the provisioning recipe to others.
This is really useful in the Ruby/JS community because they don't have a compile step. The way we use it is the code stays on my local machine and all the runtime is done on the VM. If I make a change on my local computer the running program on the VM instantly picks up the change and the runtime is modified just as if the code was only on the VM. I literally don't even have to have Ruby/JS installed on my computer.
In the Java/.Net world you have a compile step so as you say you need Java and all the jars you need to compile against on your machine. This lessens some of the usefulness of the setup.
On the other hand you usually have databases, message queues, containers, etc. that you are working with and on a team it may be a pain to shoot an email and say update your db to this version and load the new sample data. In Vagrant only one person needs to make the updates and they can then tell you to grab the new VM and you do not have to do any of the upgrade steps yourself.
So it is still useful in a compiled language but it is less useful than in a scripting language.