Académique Documents
Professionnel Documents
Culture Documents
txt
Maven Documentation
---------------------
-Introduction
OS/PI
Apache
XML
-Wht is a Build Tool
generate code
compile
package
deploy on server
- Ant Vs Maven
actions are defined in ant -- in Maven you say wht to build not how to build
sequence is defined in ant -- how to build is defined in maven build life cycle
No default directory layout -- standard directory struture follows
Ant can follow you -- You need to follow maven
- Installation and set M2_HOME
- POM.xml and its contents
contains source code location, test code, dependency libraries location, version, repos etc
Explain the diagram and show sample pom.xml
Project Object model (POM)
show a sample pom.xml
- Build life cycle, phases, goals
LifeCycle
---------------------------------- Life Cycle
|-------------| |-----------| |------------| Build Phases
|--| |--||--| Build Golas
When you run maven you may pass phase, goal or lifecyle as a command
- If a life cycle requested all build phases will be executed
- If a phase requested all prior phases will be executed automatically
- Dependencies and repositories
This is the first task which looks for dependecies and downloads them and keeps in local repo
- Build Plugins
https://docviewer.yandex.com/view/0/?*=HXoU359gjBCKjMzTqSHwQ5pHWtl7InVybCI6InlhLWRpc2stcHVibGljOi8vOTcxRmcwQ2lmVG4yOXNMY2M4 1/7
10/17/2017 Maven_My_doc.txt
these are extra goals inserted in standard build phases incase if the standard phases are not sufficient
for you
- Build Profiles
building the project for different environments, you insert different profiles and request to which profile
you want to build
- POM exaplanation with all elements
ModelVersion- talks about wht version of pom.xml you are using - 4.0.0 used for maven2 and 3
groupid - any arbitary value or you can use your company name
artifactid - uniq id and name of the project within the group, used while creating jar/war/ear files
version - current version of the project
name - human readable name
url - URL of project website
packaging - style of packaging ( jar/war/ear etc)
Dependencies - defines list of dependent libraries and it downloads them from defined repository
repositories - alternative location to look for depedencies apart from default repos
build - specifies configuration on how to build the project
reports - specifies configuration on what reports need to generate
- Standard directory structure in maven
Makes your POM smaller and easier
easier to understand for any one
easier to integrate plugins
Src/main/java -- Java source code
/main/resources -- other resources application needs
/main/filters -- resource filters in the form of property files, used run time
/main/config -- configuration file
/main/webapp -- web application dir for a war project
/main/test --unit tests
/main/test/resources -- as usual it dependencies
/main/test/filters -- for test cases
target/main/java/sdfsdf.class
Helloworld_1.0.0.jar
pom.xml
- Setting files are two
you can set all settings across all pom.xml files
https://docviewer.yandex.com/view/0/?*=HXoU359gjBCKjMzTqSHwQ5pHWtl7InVybCI6InlhLWRpc2stcHVibGljOi8vOTcxRmcwQ2lmVG4yOXNMY2M4 2/7
10/17/2017 Maven_My_doc.txt
$mvn archetype:generate It will ask you to provide coordinates to generate maven project
<activeByDefault>true</activeByDefault>
</activation>
- Multi Module project example and executions : ch-multi (whether app project demo)
- ANT to Maven migrations:
https://code.google.com/p/mavenize-tool/
https://docviewer.yandex.com/view/0/?*=HXoU359gjBCKjMzTqSHwQ5pHWtl7InVybCI6InlhLWRpc2stcHVibGljOi8vOTcxRmcwQ2lmVG4yOXNMY2M4 7/7