views:

83

answers:

2

It's been a while since I did Java work, and even then I was never responsible for starting a large project from the very start... there were test/staging/production systems already running, etc, etc.

Now I am looking to start a J2EE project from scratch on my trusty workstation, which has never been used for Java development and runs Windows 7 64bit.

First of all, I'll be getting Eclipse. As far as writing the code goes I'm pretty happy. And running it through Eclipse is OK, but what I'd really want is to have a VM running MySQL and TomCat on which I can properly deploy my project and run/debug it 'remotely' from my dev PC. And I guess this should be done using Ant instead of letting Eclipse build the WAR for me, so that I don't end up with a dependence on Eclipse. I'm certain Eclipse can do this, so you hit a button and it runs Ant scripts, deploys and debugs for instance, but very hazy on it.

Are there any good guides on this? I don't want to be taught Java, or even Ant, but rather the 'glue' parts like getting my test VM up and running under Windows, getting a build/test/deploy/run pipeline running through Eclipse, etc. One point, I only plan to use Windows... hosting a Windows VM on my Windwos desktop. And while I can use command-line tools like ant/svn, I'm much more a GUI person who loves IDE integration... I'd rather this didn't end up an argument about Linux or Vi, etc!

I am looking for free, but am a MAPS subscriber, and run Win7 Ultimate in case that makes a difference as far as free VM solutions.

+1  A: 

I'm not sure about using a separate VM for the deployment, but I run a local SQL server and tomcat instance on my dev machine. To deploy to tomcat from eclipse is two steps for me:

  • Run an ant script that builds the contents of the war to a build directory.
  • Start tomcat from eclipse

In order to do the second part you can use the Eclipse Tomcat plugin from here This will give you nice toolbar buttons in eclipse for starting and stoping tomcat. I configure tomcat so that it loads the app directly from my build folder so there's no copying and exploding of war files involved.

A great advantage of this is that I can debug the code from eclipse at runtime.

If you've any more specific questions about this just ask.

Alb
I can't remember, but Eclipse doesn't build using Ant does it? Is it possible to make it use Ant, or is that a dumb idea? I was just thinking that it's kind of weird having a dual-build strategy, but I'm coming from a C++ mindset where the way you build can change the behaviour quite easily...
John
I've seen some of these integration plugins before, that's what I'm after. Does it let you do remote debugging (to a VM for instance) or would it be easier to do it all locally as Bogdan suggests?
John
As I said I don't see the need for a VM by default, I just run my DB and tomcat on the dev machine's OS, so I'm not sure if you can do remote debugging. I'm not sure that invoking Tomcat on another VM from eclipse would be possible though. What's your reason for wanting a VM?As for ant, yes you can invoke ant build targets from Eclipse and you don't need any extra plugins to do it.
Alb
VMs let me do a few things (in my mind anyway). I can have one VM for a server and another for a client, letting me test the client on a clean workstation with different browsers. It also lets me avoid cluttering my dev-box with loads of web-servers and DBs. Maybe in practice I'd still deploy to my dev-box for development-testing, then use a VM for a test/staging server.
John
That makes sense and I can see the advantages of a VM, but I don't know if there's a good case for deploying to a VM directly from the IDE as you develop. If using a VM as a testing/staging server it would probably make more sense to commit code to source control and have a continuous integration s/w (Hudson is great for this) create builds.
Alb
A: 

I use NetBeans which integrates rather nicely with glassfish. Don't know about Tomcat but GF has a "hot deployment" feature. Basically you define a folder where your application is and all you have to do is copy the war/ear file there and is automatically deployed. NetBeans does this automatically and I also have integrated debugging.

I believe in Eclipse things should be easy too. From what I remember you need to define a server - like a separate project (configure the path & stuff) and it does the rest by itself.

Oh, and I also don't see the need for a VM. If it works for localhost it will work for anyhost :)

Bogdan
I guess you're right on the VM, but it feels more 'real' to deploy to a different machine somehow.
John