Maven
Maven
What is Build?
Build : Compile + Assembly + Create deliverable
Compile : Convert Source code to machine readable format
Assembly (Linking) : Grouping all class files
Deliverable : .war, .jar
Architecture of Maven
Architecture of Maven
Goals:
1. Generate resources ( Dependencies)
2. Compile code
3. Unit test
4. Package (Build)
5. Install (in to local repo & artifactory)
6. Deploy (to servers)
7. Clean (delete all run time files)
eg: mvn install
mvn clean package
Maven Repositories
Local (.M2)
Remote (https://repo1.maven.org/maven2/)
Pom.xml contains
Metadata
Dependencies
Kind of project
Kind of output (.jar, .war)
Description
Important points
Maven is all about plug-ins
Snapshot: Indicates development copy of your project. Not the
one which you are going to release.
eg: 1,0-SNAPSHOT
If you see version no in place of snapshot, then it means product
is ready to give customer.
Multi-module project
Multi-module project
Simply dividing project into modules
Each module must have it's own SRC folder & pom.xml so that
build will happen separately
To build all modules with one command, there should be a parent
pom.xml file. This calls all child pom.xml files automatically
In parent pom.xml file, need to mention the child pom.xml order.