Apache Maven is a basically used for managing project's build, reporting and documentation. Maven is based on model which is called POM(Project Object Model).
Consider example that you need to use log4j for your application for logging.
In Usual way , you need to search,download and add log4j.jar into your project dependency and what if upgraded version of log4.jar is available and you want to add into your project. You have to do this manually. Maven can assist you in order to overcome with this manual process.
In Maven, you need to know "maven coordinates" for library you want to add into your project. Ex. coordinates for log4.j which you can find at Maven Central Repository
Once you have groupId,artifactsId and version available then You should add following lines into your Project's pom.xml
When you build your project or compile your project, libraries are downloaded automatically to maven local repository and downloaded jar will be added to application dependency. Consider example that you need to use log4j for your application for logging.
In Usual way , you need to search,download and add log4j.jar into your project dependency and what if upgraded version of log4.jar is available and you want to add into your project. You have to do this manually. Maven can assist you in order to overcome with this manual process.
In Maven, you need to know "maven coordinates" for library you want to add into your project. Ex. coordinates for log4.j which you can find at Maven Central Repository
Once you have groupId,artifactsId and version available then You should add following lines into your Project's pom.xml
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
You can use following command to create Java Project with Maven
mvn archetype:generate -DgroupId=
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Ex. mvn archetype:generate -DgroupId=com.anuj -DartifactId=MyProject
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
No comments:
Post a Comment