If you have a java application with pom.xml file, just run the following command. To validate the maven installation, you can start by building a Java application. Important Maven Configuration Table Validate Maven Using Java Build This file contains all the maven configurations that are common for all the projects. When you run maven commands, all the remote repositories get cached locally in the. The location is the corresponding maven installation directory in the system. Maven Important Configurationsįollowing are the important maven configurations you should know. Note: In Ubuntu based systems, you can also add M2_HOME and PATH variables to users. Step 5: Verify maven installation mvn -version Step 4: Source the script for changes to take immediate effect. Step 3: Add execute permission to the maven.sh script. Step 2: Add the following to the script and save the file. Step 1: Create a script file named maven.sh in the profile.d folder. So that every time the shell starts, it gets sourced and the mvn command will be available system-wide. We will do both by adding them to the profile.d folder. To access the mvn command systemwide, you need to either set the M2_HOME environment variable or add /opt/maven to the system PATH. So that there wont be any build issues due to version mismatch when you take the code from development to deployment environments Add Maven folder to System PATH Note: Always install specific version of maven that is used across CI environment. sudo ln -s /opt/apache-maven-3.9.0 /opt/maven ![]() This way, when you have a new version of maven, you just have to update the symbolic link and the path variables remain the same. Step 3: Create a symbolic link to the maven folder. Step 2: Untar the mvn package to the /opt folder. Step 1: Go to Maven Downlaods and get the download link of the latest package. java -version Install Maven (Latest From Maven Repo)įollow the steps given below to install the latest maven package from the official maven repo. Verify Java JDK installation using the following command. The basic prerequisite for Maven is Java JDK because Maven is a build tool and it requires all the build and compiles related java tools.įor Ubuntu, sudo apt install openjdk-17-jdk openjdk-17-jre -yįor Amazon Linux, sudo yum install java-17-amazon-corretto-devel -yįor Redhat Linux, sudo yum install java-17-openjdk -y A developer primarily deals with the development aspects using maven while devops engineers deal with setting up a Continuous Integration pipeline using maven. ![]() It is primarily used by developers working on java projects and devops engineers working on CI/CD pipelines. In this blog, you will learn to install maven on different platforms and learn about maven configurations using step-by-step guides.Īpache maven is one of the best open-source java build tools.
0 Comments
Leave a Reply. |