What is a reasonable way to convert a complicated Ant script to a set of Eclipse projects?
I inherited an existing Ant build script. It invokes javac
three times on three different source directories: shared, client, and server. It then produces two JAR files: client.jar (shared + client) and server.jar (shared + server).
When I translated this to Eclipse, I ended up making three projects with appropriate dependencies. This works, but I'm not a fan of the Eclipse project explosion (this was an easy case; I have about a dozen such ant scripts, and some would turn into 6 or 7 Eclipse projects).
My question: is there a better way?
I should also mention that I do开发者_C百科n't want to simply create one Eclipse project with three source directories. That's not the way that Ant compiles the code, and it would make it harder to find cases where people were using classes from an inaccessible source tree (using server classes from the client code). (I also happen to have classes with the same name in client and server, so I actually can't just dump all the source together.)
We have a similar project set up: 13 eclipse projects each with their own ant scripts. 7 of them are shared and produce JARs the other 6 are webapps that get packaged in to WARs. The ant script for each of the WAR-producing projects invokes the build in its dependencies and sucks the generated jars in to the lib. So, no, we don't have a better way, but I have a fuzzy vision for how things could be better if we switched from ant to maven:
The 7 shared projects change much less frequently than the webapps. I would like to publish those shared project JARs to our own repo and then for each of the webapps specify which version of the dependency they need and let maven handle getting it for us. That way we wouldn't need to have all of the JAR projects open in Eclipse unless we were making changes to them.
精彩评论