How to Install Apache Maven on Debian 10 - MS TV Life.COM

How to Install Apache Maven on Debian 10

How to Install Apache Maven on Debian 10

Apache Maven is an open-source challenge administration and comprehension instrument used primarily for Java initiatives. Maven makes use of a Venture Object Mannequin (POM), which is basically an XML file containing details about the challenge, configuration particulars, the challenge’s dependencies, and so forth.

How to Install CouchDB on Debian 10(Opens in a new browser tab)

This text reveals two methods to put in Apache Maven on Debian 10.

The usual Debian repositories comprise Maven packages that may be put in with the apt bundle supervisor. That is the best technique to set up Maven on Debian. Nevertheless, the model included within the repositories could lag behind the newest model of Maven. To put in the newest model of Maven, comply with the directions offered within the second a part of this text.

Select the set up methodology that’s most applicable to your setup and surroundings.

Conditions #

The directions assume that you’re logged in as root or person with sudo privileges.

Putting in Apache Maven on Debian with apt #

Putting in Maven on Debian utilizing apt is a straightforward, simple course of.

  1. Replace the bundle index and set up Maven by working the next instructions: sudo apt replacesudo apt set up maven
  2. Run the mvn -version command to confirm the set up: mvn -version The output ought to look one thing like this: Maven residence: /usr/share/maven Java model: 11.0.6, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-Eight OS title: "linux", model: "4.19.0-6-amd64", arch: "amd64", household: "unix"

That’s it. Maven has been put in in your Debian system, and you can begin utilizing it.

Putting in the Newest Launch of Apache Maven #

On this part, we’ll present a step-by-step directions about learn how to set up the newest Apache Maven model on Debian 10.

How to Install Ruby on Debian 10

1. Set up OpenJDK #

Maven 3.3+ requires JDK 1.7 or above to be put in in your system.

Set up OpenJDK 11, by typing:

sudo apt replacesudo apt set up default-jdk

Confirm that Java was efficiently put in by checking its model:

java -version

The output ought to look one thing like this:

openjdk model "1.8.0_181"
OpenJDK Runtime Atmosphere (construct 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (construct 25.181-b13, blended mode)

2. Obtain Apache Maven #

On the time of writing this text, the newest model of Apache Maven is 3.6.3. Earlier than persevering with with the following step, test the Maven obtain web page to see if a more moderen model is out there.

Use wget to obtain the Apache Maven archive within the /tmp listing:

wget https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp

As soon as the obtain is accomplished, extract the archive within the /decide listing:

sudo tar xf /tmp/apache-maven-*.tar.gz -C /decide

To have extra management over Maven variations and updates, we are going to create a symbolic hyperlink maven that can level to the Maven set up listing:

sudo ln -s /decide/apache-maven-3.6.3 /decide/maven

Later, to improve your Maven set up, merely unpack the newer model and alter the symlink to level to the newest model.

3. Setup surroundings variables #

Subsequent, we’ll have to arrange the surroundings variables. To take action, open your textual content editor and create a brand new file named mavenenv.sh within the /and so forth/profile.d/ listing.

How to Set Up Nginx Server Blocks on Debian 10

sudo nano /and so forth/profile.d/maven.sh

Paste the next traces:

/and so forth/profile.d/maven.sh

export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/decide/maven
export MAVEN_HOME=/decide/maven
export PATH=${M2_HOME}/bin:${PATH}

Save and shut the file. The script shall be sourced at shell startup.

Make the script executable by typing the next chmod command:

sudo chmod +x /and so forth/profile.d/maven.sh

Load the surroundings variables within the present session utilizing the source command:

supply /and so forth/profile.d/maven.sh

4. Confirm the set up #

To validate that Maven is put in correctly use the mvn -version command which is able to print the Maven model:

mvn -version

You need to see one thing like the next:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven residence: /decide/maven
Java model: 11.0.6, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS title: "linux", model: "4.19.0-6-amd64", arch: "amd64", household: "unix"

That’s it. The most recent model of Maven is now put in in your Debian system.

Conclusion #

We’ve got proven you learn how to set up Apache Maven on Debian 10. Now you can go to the official Apache Maven Documentation web page and discover ways to get began with Maven.

How to Configure Git Username and Email Address

Should you hit an issue or have suggestions, go away a remark beneath.

Copy link
Powered by Social Snap