Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.

Similar presentations


Presentation on theme: "Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene."— Presentation transcript:

1 Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene

2 History Make – Not the best tool for building Java projects  Platform-dependent  Not easy to use Ant – A revolutionary build tool Platform-independent Uses XML configuration file (build.xml)‏  XML configuration file is extremely abstract  High learning curve (syntax)‏ Maven 1.0 – Replacement for Ant?  Uses Ant at its core

3 Features Standardized project layout and project structure generator Standardized dependency-management mechanism Multiple project support Instant downloads of new plug-ins and features as the developer needs them Website generation for up-to-date project information

4 Project Object Model (POM)‏ The POM file is a set of instructions for Maven that tells it how to build the project and includes other special instructions The POM takes the form of an XML file (pom.xml)‏ Maven includes the JUnit dependency by default to encourage unit testing

5 Dependency Management Transitive Dependencies Maven will take care of the libraries that your libraries need Dependency Scopes compile: Available in all phases (default value)‏ provided: Used to compile the application but will not be deployed runtime: Needed only for execution and not for compilation (eg: JDBC drivers)‏ test: Needed only to compile and run tests (eg: JUnit)‏

6 Structure src/main/java: Java source code src/main/resources: Other resources src/main/filters: Resource filters in the form of properties files, which may be used to define variables only known at runtime src/main/config: Configuration files src/main/webapp: The Web application directory for a WAR project

7 Structure src/test/java: Unit tests src/test/resources: Resources to be used for unit tests, but will not be deployed src/test/filters: Resource filters to be used for unit tests, but will not be deployed src/site: Files used to generate the Maven project Website

8 Project Life Cycle Default Build Phases validate: Validate the project is correct and all necessary information is available compile: Compiles project source code test: Test the compiled source code using a suitable unit testing framework such as JUnit. These tests should not require the code be packaged or deployed package: Take the compiled code and package it in its distributable format, such as a WAR, JAR etc.

9 Project Life Cycle Default Build Phases integration-test: Process and deploy the package if necessary into an environment where integration tests can be run verify: Run any checks to verify the package is valid and meets quality criteria install: Install the package into the local repository, for use as a dependency in other projects locally deploy: Copies the final package to the remote repository for sharing with other developers and projects (done in an integration or release environment).

10 Maven Site Generation Build Phase site: Generates the project website Project Management Reports General project information (source repositories, defect tracking, team members, etc.)‏ Unit test and test coverage reports (Corbetura plug-in)‏ Automatic code reviews (Checkstyle plug-in)‏ Configuration and version information Dependencies Java-docs Source code in indexed and cross-referenced HTML format Team member list

11 Conclusion Maven 2.0 is... A powerful tool that greatly simplifies and standardizes the build process Promotes a standard project outline and incorporates recommended best practices Standard plug-ins such as the site generator provide valuable team-oriented project tools with little extra effort


Download ppt "Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene."

Similar presentations


Ads by Google