Ant With Convention Over Configuration Dependency Management Uniform Build System. Project Structure. Coherent site of project information along-with Internationalization. Release management and distribution publication.WHY MAVEN!
Concerns to build a project Project directory structure Directory naming conventions The build output
Contains project information and configuration details used to build the project ◦ – Project dependencies ◦ – Commands (goals) that can be executedProject Object Model ◦ – Plugins ◦ – Metadata The minimum requirement for a POM are the following: ◦ project root ◦ modelVersion - should be set to 4.0.0 ◦ groupId - the id of the projects group. ◦ artifactId - the id of the artifact (project) ◦ version - the version of the artifact under the specified group e.g.: ◦ <modelVersion>4.0.0</modelVersion> ◦ <groupId>com.cisco.ccw.config</groupId> ◦ <artifactId>ConfigService</artifactId> ◦ <packaging>jar</packaging> ◦ <version>7.0</version> ◦ <name>CCW Config Services</name> ◦ <url>http://www.cisco.com</url>
Build Lifecycle and Phases Most important default phases: ◦ Validate ◦ Compile ◦ Test ◦ Package ◦ Install ◦ Deploy Some common phases not default: ◦ Clean ◦ Site
Dependency scope Compile: Available in all classpaths (default) Provided: The JDK or the container provides it Runtime: Only required for execution, not for compilation Test: Only required for testing, not for normal use (not deployed) System: You provide it locally, not looked up in a repo <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.4</version> <scope>compile</scope> </dependency>
FEATURES ANT MAVEN Dependency Management Versioning Manually defined Compile Java code, build jars Execute tests, report results, fail build on failed tests Build vs. deploy vs. release Manually defined Full control when needed Custom XML Write custom “scripts” plugin or embedded Ant script Documentation / Support Excellent Growing but stillAnt vs Maven inconsistent Run quality check tools (PMD, FindBugs, JavaDoc) 3rd party task 3rd party plugins libraries File generation (XmlBeans, XSL, Velocity, AspectJ) 3rd party task 3rd party plugins libraries Generating the Site