Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Maven--->java based open source tool and platform independant

Maven,Gradle,ANT-->

Maven is a build tool and project management tool.-->This only for java
applications.
This is for java based applications Means it's going to create a package-->The
process of crating package or artifacts is called build.
build means --->it will convert your source from human readable format to system
readable format.(byte code)

i)standared applications(.jar_) souce--> (It contains java classes)-->pom.xml---


>Project object model--->
2)web applications (.war)-->Web +Jar(It contains web related content and java
classes)
3)enterprise applications(.ear)web +jar(It contains atleast one war file).

In maven we have 3 repositories 1)Local repository---->users/.m2/repository ---


>windows-->Windows
2)Central repository--->
/home/user-directory(kumar)/.m2-->Linux
3)Remote repository.(Remote server)
1)Local repository:
Maven local repository is a folder, where we can store all the dependies.
If you try to build the souce code in to package.

Central repository:
The central repository is the repository provided by the Maven community. It
contains a large repository of commonly used libraries. This repository comes into
play when Maven does not find libraries in the local repository.

3)Remote repository
organizations usually maintain their own repositories for the libraries that are
being used for the project. These differ from the local repository; a repository is
maintained on a separate server, different from the developer's machine and is
accessible within the organization.

If you execute maven goals -->What are the dependies your mention in pom.xml--
>Maven first it will check in your local repository-->If it's not found-->Then it
will get it from central repository and if any dependies are not there in central
repository then those get it from remote repository and build the package.

There are three maven life cycles are there-->

Life cycle name Goals-->


1)clear clear --->.jar --->maven clear -->it will
deletes previous build jar files.
2)site site ----->it will generate the project site
documentation.
3)default
validate -->validate project folder structure.
compile -->compile your source code
test -->test using a suitable unit tetsing frame work.(Junit test frame )
package-->it will take the source code and converted into package.(.jar or .war
or .ear)
install -->it will build and moved the package into local repository.
deploy-->it will store the final package into the remote repository.

To invoke a maven build you set a life cycle goal.


If you execute morethan one goal. It will execute from Left to right.
If any goal is failed, Further goals are not going to be executed.

mvn clean package -->To create package

mvn package -DskipTests -->To skip tests.

You might also like