Maven/Eclipse with Vagrant

Friday, July 11, 2014

I'm trying to convert a Java project which builds in Maven (and Gradle and Ant... it's complicated unfortunately) to use Vagrant. I already have most of the machine provisioned with Puppet, and it's awesome having a portable, destructible development environment and not having to install and configure all of this software on my own personal machines.


The problem I'm currently facing is this: how will I resolve my classpath in Eclipse? My build tools (Maven, Gradle, Ant) are installed on the Vagrant box, and they download archives to the local machine in /home/vagrant/.m2 etc.


Here's what I can do fairly easily over the Vagrant machine:



  1. Build my entire software project using the Ant, Maven, and Gradle build tools installed on the Vagrant machine.

  2. Run my entire software project on my application servers installed on the Vagrant machine.

  3. Access and interact with the application servers over a forwarded HTTP port.


Here's what I'm sorely missing:



  1. Develop using Eclipse and using the Maven/Gradle classpath which exists inside of the Vagrant VM.

  2. Debug/Run using Eclipse, starting the applications inside of the Vagrant container to make use of that environment and not my host machine's environment.


Are there Eclipse plugins which will allow me to use a remote classpath with m2eclipse? Can I run/debug Java executables remotely on the Vagrant machine?


If "the bottom line™" is that I simply must have Maven and Gradle installed on my local machine in addition to the Vagrant box, then it is what it is; otherwise, I'd really prefer to keep my local machine as lightweight as possible.







http://ift.tt/VUrhGk