We all know that Maven is the Best Project Management Tool that based Project Object Model. It utilized for project building, Documentation and Dependency. It simplifies the inbuilt process like ANT. We can say it as a tool for Java-based project. It makes easy work of Java Developer very easier. In general, it helps comprehension in any Java project. In our blog Maven In Java, you will see how Maven is Implemented in Java.
Eventually, With Maven, we can integrate the program very easily, with source control systems. We can design any number of program that is like WAR, JAR and Scripting. It is helpful for scheme Designing and scripting Process. Usually, Updates program with a central repository of JARs and another type of Dependencies. It offers scheme Information and adds Jars, other dependencies with help of maven. In particular, We can build a strategy easily with maven.
Download Maven Java Libraries, it plug-ins from one or many repositories like maven 2. It stores local cache, this guide downloadable Artifacts. Immediately, this can be updated with artifacts designed by local program. As a matter of fact, Public repositories also updated.
Not only Java but also used for designing Scala, Ruby, #C, and other Languages. In addition, hosted by apache Software Foundation, known as the Jakarta scheme.
Dependencies were just like Java libraries that need for repositories and Directories for JAR files. To illustrate, local Repository is like your machine hard drive. When dependencies not found in local Maven Repository. Specifically, Maven downloads them with central Maven Repository, and they keep in local Repository.
Build Plugins utilized for performing certain specific Targets. You have to add a plugin for POM File. The Maven Central has some standard type of Plugins. You can use them and Implement them in your Own Java.
First, we have to verify, the system has Java Installed in it or not. If not then we have to install Java.
In other words, Check Java Environmental Variable, which is set or not. If not we have to Install Java environmental variable.
Therefore Download Maven.
Unpack your maven Zip at any place in the system.
After that add bin Directory for Designing Directory Apache maven-3.5.3.
Open CMD and after that, you have to Run mvn-v command. If it prints the following lines of code, then the installation is finished.
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2019-02-25T01:19:05+05:30) Maven home: C:\apache-maven-3.5.3\bin\.. Java version: 1.8.0_151, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_151\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
<modelVersion>4.0.0</modelVersion> <groupId> com.project.loggerapi </groupId> <artifactId>LoggerApi</artifactId> <version>0.0.1-SNAPSHOT</version> <!-- Add typical dependencies for a web application --> <dependencies> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>2.11.0</version> </dependency> </dependencies> </project>
What elements used for Designing Pom.XML file.
Generally, the version element has a version number of the program. If your scheme released in many versions, then it useful for offering the version of your project Maven Central Repository.
At the same time, artifactID utilized for offering the name of program, Moreover, you were designing. In the example name of our scheme known as logger API.
Especially, Group-ID is known as Program Group, it is single and unique. Every time you have to use the group ID. In conclusion, that is similar to the Root Java Package. Name of project, like we use group-ID com.project.logger API Maven dependency.
Generally, a Model version known as which version of POM sample that you use. In the same fashion, the use of version 4.0.0 for maven 3 and maven 2.
It is the main root element of the POM.xml file.
When we work with Java Program, the project has many dependencies. Consequently, that design the requirement, then managing everything in a manual mode. In the same fashion, which is very difficult and tiresome. Practically using some tool that does these works is so much helpful MVN.
Equally, When we generate total Maven scheme design, with the help of Java Source code. To illustrate, maven designed an App.java class, that is known as ./src/main/folder, that which is a simple “Hello World” program. For example, It designed small example, test session in
./src/test/. In the Root Folder, where there is a pom.xml file. <project> <modelVersion>4.0.0</modelVersion> <groupId>com.vogella.build.maven.java</groupId> <artifactId>com.vogella.build.maven.java</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>com.vogella.build.maven.java</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
These are the best-known facts about Maven in java.