Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

Julien Martin

Hello,

I would like to use Vagrant 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:

  • What files/folders am I supposed to share? (not the whole eclipse workspace I suppose)
  • Am I better off using a exploded or a normal war archive?
  • How do I configure Eclipse (which lives on the host) to see the remote Tomcat (the one that lives on the guest).

Is all of this feasible with Vagrant?

Regards,

Julien.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

VMTrooper
Hello Julien,

The guest will have an IP that your host will be able to connect to.

By default, the folder where your Vagrantfile resides is automatically shared with the guest as "/vagrant". If you need to share any other folders with the guest, look up the appropriate VboxManager setting to do so, and you can specify it in the Vagrantfile.

If copying and pasting the war file to the directory that Vagrant already shares, then you are good to go.

-Trevor

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

Samuel Brown
In reply to this post by Julien Martin
Hi Julien,

I have done this type of work with Vagrant in the past so hopefully I can point you in the right direction.  Here are my recommendations:

1) DO start Vagrant from the root of your workspace.  As Trevor mentioned below, all files will now be accessible on the Vagrant box from the /vagrant directory.  This is very helpful to prevent copying of resources, etc.
2) Use port forwarding for both MySQL and your tomcat server. This will give you remote access on 'localhost' and the port you choose to forward and should allow you to configure Eclipse to see it remotely. (http://docs.vagrantup.com/v2/networking/forwarded_ports.html)
3) Regarding WAR vs Exploded, I would recommend installing Tomcat on your Vagrant box and sharing that folder so that you can reach it via Eclipse and then use the exploded method.  This should facilitate rapid development with in-place changes. You can see how to easily share folders in the Vagrant documentation: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html

I'm a little unclear on what you mean by "set up a java development requirement" though.  If you provide a little more clarity on what you want to achieve I might be able to better recommend an approach.

Good luck,

Sam 

On Saturday, July 13, 2013 4:38:46 PM UTC-4, Julien Martin wrote:

Hello,

I would like to use Vagrant 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:

  • What files/folders am I supposed to share? (not the whole eclipse workspace I suppose)
  • Am I better off using a exploded or a normal war archive?
  • How do I configure Eclipse (which lives on the host) to see the remote Tomcat (the one that lives on the guest).

Is all of this feasible with Vagrant?

Regards,

Julien.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

Julien Martin
First: sorry for the delay in replying. 

Second: thanks a lot to both of you for your replies!  

I think I am starting to understand how port forwarding can help. I'll try what you advised when I return home to my "Vagrant-equipped" machine tonight and post here accordingly.

Regards,

Julien.



Le lundi 15 juillet 2013 17:18:09 UTC+2, Samuel Brown a écrit :
Hi Julien,

I have done this type of work with Vagrant in the past so hopefully I can point you in the right direction.  Here are my recommendations:

1) DO start Vagrant from the root of your workspace.  As Trevor mentioned below, all files will now be accessible on the Vagrant box from the /vagrant directory.  This is very helpful to prevent copying of resources, etc.
2) Use port forwarding for both MySQL and your tomcat server. This will give you remote access on 'localhost' and the port you choose to forward and should allow you to configure Eclipse to see it remotely. (http://docs.vagrantup.com/v2/networking/forwarded_ports.html)
3) Regarding WAR vs Exploded, I would recommend installing Tomcat on your Vagrant box and sharing that folder so that you can reach it via Eclipse and then use the exploded method.  This should facilitate rapid development with in-place changes. You can see how to easily share folders in the Vagrant documentation: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html

I'm a little unclear on what you mean by "set up a java development requirement" though.  If you provide a little more clarity on what you want to achieve I might be able to better recommend an approach.

Good luck,

Sam 

On Saturday, July 13, 2013 4:38:46 PM UTC-4, Julien Martin wrote:

Hello,

I would like to use Vagrant 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:

  • What files/folders am I supposed to share? (not the whole eclipse workspace I suppose)
  • Am I better off using a exploded or a normal war archive?
  • How do I configure Eclipse (which lives on the host) to see the remote Tomcat (the one that lives on the guest).

Is all of this feasible with Vagrant?

Regards,

Julien.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Setting up a java/j2ee development environment with: Eclipse, Tomcat and Vagrant

Julien Martin
In reply to this post by Samuel Brown
Hi again Samuel!

I tried as advised (successfully set up vagrant on win host and using precise32 on guest) and I am running into the following issue:
  • Eclipse asks me for the following information: "Tomcat installation directory" (see screen capture attached). I am not sure how to trick Eclipse into using the tomcat on the guest machine here...
Can you please point me in the right direction?
Regards,
Julien.


Le lundi 15 juillet 2013 17:18:09 UTC+2, Samuel Brown a écrit :
Hi Julien,

I have done this type of work with Vagrant in the past so hopefully I can point you in the right direction.  Here are my recommendations:

1) DO start Vagrant from the root of your workspace.  As Trevor mentioned below, all files will now be accessible on the Vagrant box from the /vagrant directory.  This is very helpful to prevent copying of resources, etc.
2) Use port forwarding for both MySQL and your tomcat server. This will give you remote access on 'localhost' and the port you choose to forward and should allow you to configure Eclipse to see it remotely. (http://docs.vagrantup.com/v2/networking/forwarded_ports.html)
3) Regarding WAR vs Exploded, I would recommend installing Tomcat on your Vagrant box and sharing that folder so that you can reach it via Eclipse and then use the exploded method.  This should facilitate rapid development with in-place changes. You can see how to easily share folders in the Vagrant documentation: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html

I'm a little unclear on what you mean by "set up a java development requirement" though.  If you provide a little more clarity on what you want to achieve I might be able to better recommend an approach.

Good luck,

Sam 

On Saturday, July 13, 2013 4:38:46 PM UTC-4, Julien Martin wrote:

Hello,

I would like to use Vagrant 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:

  • What files/folders am I supposed to share? (not the whole eclipse workspace I suppose)
  • Am I better off using a exploded or a normal war archive?
  • How do I configure Eclipse (which lives on the host) to see the remote Tomcat (the one that lives on the guest).

Is all of this feasible with Vagrant?

Regards,

Julien.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

tomcat-eclipse-02.png (47K) Download Attachment