Reputation: 1039
I am rather noob at java jars deployment. I have following scenario: I have about 6 projects in eclipse and they are of various types (core project for common interfaces, projects containing osgi bundles, project with tests, project with servlets for web deployment).
I have growing problem of getting anything deployed quickly, today I am faced with OSGi bundle deployments, I want to quickly and reliably package my bundle and deploy it into container. Up to this day i was just doing it stupidly by exporting jar through eclipse and then editing the manifest.
I think the best way (without too much work) would be using one big Ant buildfile with targets that will solve things I need most urgently (createing OSGi bundles now) and then move more build logic, step by step, from eclipse into build file (i understand there is a easy way to run ant targets through eclipse and even replace autoprojectbuild logic of eclipse with custom build file).
So this is my plan:
1) create 1 master build file with everything in src directory (containing all projects)
2) create task for building project with OSGi bundle. Using manifest.txt with handcrafted manifest for my bundle and Copy Paste (via ant task) all jars, needed in this bundle and use Bundle-ClassPath to declare my inner bundle dependencies
3) create JUnit test runners as custom targets
4) create other targets for building various projects
5) finally before release, create big target "dist" to package whole software
So my 2 questions are:
Is this plan of mine good (in terms of development time and reasonable complexity)?
Are there any drawbacks using 1 big buildfile? I read part of Ant in Action book but it looks like multiple build files just causes more complications (it's not easy to declare dependencies between projects. OTH with 1 big file i can use target depends attribute).
Upvotes: 1
Views: 255
Reputation: 707
Sounds like a good candidate for Maven rather than Ant. All the things you're talking about doing are covered by Maven archetypes. It's a steepish learning curve but really worth the effort.
Upvotes: 1
Reputation: 1396
Having a scripted build/deployment is almost always a good step. It just opens up many more possibilities for automating not just deployments, but test builds, continuous integration, etc. Personally I wouldnt get too hung up on trying to get the integration between eclipse (your IDE) and the build tool. If it works easily clicking something in eclipse, great, but its probably worth the effort becomming comfortable running the script from the command line. Separating these two concerns (development experience, from build lifecycle) will also open up more options if you find that ant isnt the right tool for your project, or maybe even you might want to move to a different IDE one day.
Upvotes: 2