APACHE MAVEN Bhavana Sudharshan Jaydeep Patel
Introduction What is Maven? “Maven is a software management and comprehension tool based on the concept of Project Object Model (POM) which can manage project build, reporting, and documentation from a central piece of information” What is POM? “As a fundamental unit of work in Maven, POM is an XML file that contains information about project and configuration details used by Maven to build the project” History: Jakarta Turbine Project
Objectives and Characteristics of MAVEN Maven is more than just Build Tool Maven was built considering certain objectives Maven Provides: Easy Build Process Uniform Build System Quality Project Information Guidelines for Best Practices Development Achieved Characteristics: Visibility Reusability Maintainability Comprehensibility “Accumulator of Knowledge”
1.One level above ANT 2.Higher level of reusability between builds 3.Faster turn around time to set up a powerful build 4.Project website generation 5.Less maintenance 6.Greater momentum 7.Repository management 8. Automatic downloads ANT MAVEN Target build.xml Goal pom.xml Comparison with ANT
Main Features of MAVEN Build-Tool Dependency Management Tool Documentation Tool
Overview of Simple Architecture
mvn archetype:generate -DgroupId = com.mycompany.app -DartifactId = my-app -DarchetypeArtifactId = maven-archetype-quickstart -DinteractiveMode = false Project Creation in MAVEN
POM source tree for your application's sources source tree for your test sources Contents of the Created Project
4.0.0 com.mycompany.app my-app jar 1.0-SNAPSHOT Maven Quick Start Archetype junit test POM.XML
BUILD.XML
Project Object Model (POM) Metadata: Location of Directories, Developers/Contributors, Dependencies, Repositories Dependencies (Transitive Dependencies), Inheritance, and Aggregation Key Elements Project Model Version Group ID Packaging Artifact ID Version Name URL Description
src/main/javaApplication/Library sources src/main/resourcesApplication/Library resources src/main/filtersResource filter files src/main/assemblyAssembly descriptors src/main/configConfiguration files src/main/scriptsApplication/Library scripts src/main/webappWeb application sources src/test/javaTest sources src/test/resourcesTest resources src/test/filtersTest resource filter files src/siteSite LICENSE.txtProject's license NOTICE.txtNotices and attributions required by libraries that the project depends on README.txtProject's readme Standard Directory Layout
Artifact Repository (Local) Build C Artifact Repositories (Remote) Look for A & B com.acme B [1.0,) compile « Any Version After 1.0 » Dependency Management
Allows automatically inclusion of libraries Avoids the need to discover and specify the required libraries that your own Transitive Dependencies
mvn site pom.xml... website scp:// mvn site-deploy Documentation – Building Own Site
Report Generation
Sources