Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA + Vagrant: compile and run in VM environment

I have to use a Java library that has a lot of bugs on Mac OS X and I can't stop using it. I set up a VM (Ubuntu 13) and set up my development environment there, and that works. But is it possible to be able to keep developing on Mac and set-up IntelliJ IDEA 13.1 to compile -> run my project in a Vagrant environment? I could not find any tutorials with how to do that, and not even sure if that's possible.

like image 753
maryokhin Avatar asked Nov 11 '22 08:11

maryokhin


1 Answers

you can continue working on mac/intelliJ to edit and compile your project files, to run it, it will depend what you are using.

  1. To synchronize the files between your os and the vm, you should set up a vagrant sync the folder between the 2 machines.

Lets say you run your project on mac under /Users/name/project/myproject this project is setup on intelliJ so you can run from intelliJ and compile from there. add this to your Vagrantfile

config.vm.synced_folder "/Users/name/project/myproject", "/project"

It will create a /project directory in your vm.

  1. To run your project, it really depends on your running configuration. For example you can configure a Tomcat remote Run configuration in IntelliJ so if you configure your vm information, it can manage your remote Tomcat installed on your vm. Synchronize your project folder with your Tomcat Webapps (sync_folder or symlink) and it should work.
like image 200
Frederic Henri Avatar answered Nov 14 '22 21:11

Frederic Henri