views:

90

answers:

2

I have close to about 20 projects in my Eclipse workspace. They are interdependent. Now I want to build all of them in a single war file. The thing is eclipse does it nicely... if I create a Dynamic Web Project and link sources of all the 20 projects. But I want to automate the entire process and want to be able to run a script (ant maybe..) and deploy a war in my app server.

My approach: I started with a simple approach. I tried to sequentially build each project (javac task) with destination directory as web-inf of my war. But it is giving me weird errors like : package " ** " not found,when it shows the same all the required classes in classpath (I used verbose)

Do you think, a continous integration engine will be better for my case (20 projects..) I saw Team City, but didnt get it the first time...

+1  A: 

All the CI engines that I know of require that you have a working Ant build.xml in order to work. If you can't get yours working, a CI engine won't help you.

"Weird" errors? If Ant is complaining, it means that something you're assuming is correct is not. Believe Ant. Stop thinking that you've got it right and dig into what it's telling you.

Your 20 projects might be interdependent, but I'd question whether they need to be in a single package. Are they all separate JARs that you create and add to your WAR? If so, I'd write the Ant script to create each JAR first. Get those working and then do the copy to the destination WEB-INF/lib before you create the final WAR.

Your instinct to automate this is a good one. Break it down into smaller steps. It sounds to me like you've written a wordy, complex build.xml that you can't debug now. Drop back and start with simple things (e.g., compile a single project and create a JAR for it), then assemble those smaller steps into the larger, more complex whole that you want.

duffymo
Thanks for the reply.The thought of building jars of all individual projects and adding these to war had crossed my mind, but I thought it would be better if I can build all of these into a single jar or directly compile them into a war.Its just that I didn't want any programatic disabilities to come in way of complete automation. :)
KCore
A: 

I was finally able to write an appropriate script as per my requirement. Instead of sepearate jar's for each project, I built a single war directly with all the classes of all my projects. I was making a silly mistake in setting the classpath previously.I sorted out that.

KCore