How to Install Apache Maven on Debian 11 | Holhol24
Apache Maven is an open-source device undertaking control and comprehension software utilized by Java builders international to regulate all phases of the device construction lifecycle, from development, reporting, assembling, and deployment.
You too can use Maven to construct and arrange initiatives written in C#, Ruby, Scala, and different languages.
Here, we will be able to see the way to set up Apache Maven on Debian 11.
Install Java on Debian
Apache Maven calls for JDK 7 or above. You can both set up Oracle Java or OpenJDK on your Maven set up.
READ: How To Install Java on Debian 11
OR
Here, I can be the use of OpenJDK v11 for Maven set up.
sudo apt replace sudo apt set up -y openjdk-11-jdk
Once you put in Java, test the Java set up by way of working the underneath command.
java -version
Output:
openjdk edition "11.0.12" 2021-07-20 OpenJDK Runtime Environment (construct 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (construct 11.0.12+7-post-Debian-2, blended mode, sharing)
Install Apache Maven on Debian
You can consult with Apache Maven’s legitimate web site to obtain the most recent strong edition of Maven or use the underneath command to obtain the Apache Maven v3.8.2 the use of the terminal.
curl -O https://downloads.apache.org/maven/maven-3/3.8.2/binaries/apache-maven-3.8.2-bin.tar.gz
Extract the Maven archive the use of the tar command and transfer the information to the /decide/ listing.
sudo tar -zxvf apache-maven-3.8.2-bin.tar.gz sudo mv apache-maven-3.8.2 /decide/maven
Setup Environment Variables for Maven
After you have got positioned Apache Maven binaries into the /decide listing, set the few surroundings variables for Maven by way of making a maven.sh report underneath /and so on/profile.d/ listing.
sudo nano /and so on/profile.d/maven.sh
Add the next variables with the values.
export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 export M2_HOME=/decide/maven export PATH=$https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{M2_HOME}/bin:$https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/https://www.holhol24.com/{PATH}
Get JAVA_HOME knowledge from the sudo update-java-alternatives -l command.
Load the above surroundings variables within the present shell consultation the use of the underneath command.
supply /and so on/profile.d/maven.sh
Verify Apache Maven Installation
Check whether or not the Apache Maven has been effectively configured in your machine the use of the underneath command.
mvn -version
Output:
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f) Maven house: /decide/maven Java edition: 11.0.12, seller: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS title: "linux", edition: "5.10.0-8-amd64", arch: "amd64", circle of relatives: "unix"
Conclusion
That’s All. I’m hoping you realized the way to set up Apache Maven on Debian 11.