What is MAVEN ??
It is a Open source Build automation and project management tool across all segments of the Java community. It speeds up the development life cycle of a project by facilitating a uniform build system through Convention over Configuration philosophy
Basically it helps with managing
- Builds
- Documentation
- Reporting
- Dependencies
- Releases
My First Maven Project
to create the simplest maven project execute the following commandHere we encounterd some new terms. Lets clear them. :)
- archetype => its a template of a project.It is combined with some user inputs to create a working maven project.
- generate => it is the goal of the project associated with the archetype mechanism.
- DgroupId => key identifier of a project.Typically the domain name of the organisaion is given
- DarchtypeGroupId => designated group id for the plugin that created the project
- artifact => the final output of a development project
- DartifactId => the name given to the artifact produced fro the project
Once the above command is executed the directory called my-app is created with the below directory structure.
The pom.xml file created in the project directory is significant. It is the basic unit of work in maven.It contains every important piece of information about the project. Following shows the POM.xml file
- project => top level element in all maven pom.xml files. Specifies the Urls from where the maven dependencies required for the project need to be downloaded.
- modelVersion => the version of the object model this POM uses.
- groupId, artifactId => as specified in the command used to create a maven project
- packaging => type of the package used by the artifact. eg: JAR, WAR etc.
- version => version of the artifact generated by the project. SNAPSHOT indicates that the project is in the state of development.
- name => indicates the display name used for the project
- url => indicates where the project site can be found
- dependencies
- developers and contributers
- plug-in lists
- plug-in executions
- plug-in configurations
What is Build Life Cycle ?
It is the sequence of phases which defines the order in which the gaol has to be executed. Here phase is one stage of the Life CycleMaven has 3 standard life cycles. They are :
- Clean
- Default
- Site
Clean Lifecycle
This deletes the output of a build by deleting the build directoryconsists of the following phases
- pre-clean
- clean
- post clean
pre-clean
|
execute processes needed prior to the actual project cleaning
|
clean
|
remove all files generated by the previous build
|
post-clean
|
execute processes needed to finalize the project cleaning
|
When we execute mvn postclean life cycle, all the above mentioned 3 phases are executed.
Default Lifecycle
This is used to build the application and is the primary life cycle of maven. Basically has 23 phases.Below are the main phases required to build a standard basic application.
- Validate
- Compile
- Test
- Package
- Integration-test
- Verify
- Install
- Deploy
Site Lifecycle
This life cycle is used for the creation of the project site documentation.
pre-site
|
execute processes needed prior to the actual project site generation
|
site
|
generate the project's site documentation
|
post-site
|
execute processes needed to finalize the site generation, and to prepare for site deployment
|
site-deploy
|
deploy the generated site documentation to the specified web server
|
REFERENCES USEFUL
https://www.mulesoft.com/tcat/tomcat-maven
tomcat manager
http://blog.techstacks.com/2009/05/tomcat-management-setting-up-tomcat.html
No comments:
Post a Comment