问题
I'm currently preparing to start a new project and wondering about the choice of build management tools (non-exclusive alternatives of Maven and Ant+Ivy).
The general scenario is as follows:
- small, several-person project,
- all developers use Eclipse as the IDE,
- two targets: Android (primary), and Java SE,
- we'll be in CI (Jenkins specifically), so some sort of build management is required.
Regarding the envisioned project structure:
- one general module, with most of the code and common dependencies,
- one Android-specific module, with Android-specific deps and code,
- one desktop-specific module, with desktop-specific deps and code.
And the non-technical considerations:
- in the project I'm the person responsible for build management and CI,
- I've got experience in using both Maven and Ant, but more practice in configuring the former,
- only basic knowledge of Ivy,
- I've had very mixed experiences with using Maven for Android builds, especially regarding interop with Eclipse.
Currently it looks like the best choice would be to use:
- Maven for the base (and desktop) project,
- Ant+Ivy for the Android project.
On the surface it seems like it will go fine, but my intuition tells me involving so many technologies might end up being painful in practice.
To summarize, my question is:
Given the conditions, is it OK to use the setup described in the blockquote, or should we go pure Maven/Ant+Ivy (and if so, which one and why)?
回答1:
Which one?
I would go with pure Maven approach.
Why?
The scenario you described is perfectly fit into an Aggregation (or Multi-Module) Project, From my own experience, compare with Ant, Maven provides a more efficient, reasonable and native way for managing multi-module project with inter-module dependencies.
Your project structure:
my-project/
common-lib/ <-- classic Java project, build as a jar library
desktop-app/ <-- classic Java project, build as a jar application
android-app/ <-- Android project, build as a apk application
android-app-test/ <-- Android Test project, build as a apk application
pom.xml
Your root pom.xml:
<modules>
<module>common-lib</module>
<module>desktop-app</module>
<module>android-app</module>
<module>android-app-test</module>
</modules>
By using android-maven-plugin, you can maintain a standard and unified way for release your multi-module project (more precisely, android-maven-plugin is used for building release for Android sub-module project) from command-line cross team.
By using two eclipse plugins: m2e and m2e-android (all available via Eclipse Marketplace), you can maintain a standard and unified way for import/develop/debug your multi-module project in Eclipse cross team.
As Maven is qualified for managing everything, there is no need to use Ant+Ivy.
来源:https://stackoverflow.com/questions/10506624/sensibility-of-combined-maven-antivy-build-management-for-dual-platform-desktop