How to Configure and Run Apache Maven on Debian 11 Bullseye – Guide

In this tutorial, we’ll show you the best way to install Apache Maven on Debian 11. If you don’t have any experience with it, Apache Maven is a product that helps manage projects, boards, and insights for businesses. It can handle the construction, detailing, and documentation of an enterprise from a focal data set. ..

This article is aimed at those who are familiar with using the Linux shell and have a website hosted on their own virtual private server. Installation is straightforward, and you can gain root privileges if necessary by following the steps outlined. I’ll show you how to install Apache Maven on Debian 11 (Bullseye) using a gradual approach. ..

prerequisites

  • A Linux distribution that includes Apache Maven
  • A recent version of the Apache Maven installation program
  • The Java Development Kit (JDK) installed on your computer ..

A Debian 11 server is running. ..

This server is accessible only from the root user.

sudo apt-get update

Installing Java

To install Apache Maven on Linux, Java must be installed. Without Java, you cannot install Maven. Maven itself is written in Java, so it needs a java compiler to be present on the server. ..

If you’re using Debian 11 and want to use Java 11, be sure to install the latest version of the Java SE Development Kit (JDK). Debian 11 also supports Java 17, but some old Apache Maven plugins may not be compatible with Java 17. To install Java 11, follow these steps:

  1. Open a terminal window and type “sudo apt-get update” to make sure you have the latest software packages.
  2. Type “sudo apt-get install java-11” to install the latest version of the Java SE Development Kit (JDK).
  3. If you’re using an older version of Apache Maven, you may need to uninstall it and then reinstall it with the new Java 11 support. ..

java -version

If you get an exit like the one below, you’re ready to go. ..

java -version This will show the Java 11 version number.

java -version

You will get an exit like the one below. Java version 11 is installed. ..

Installing Apache Maven on Debian 11

Now that you have updated the server and installed Java 11, you will install Apache Maven. In this step, we will download and install Maven. ..

mvn -Dmaven.version=1.5.0 This will install Maven 1.5.0 on your computer

Extracting the file: cd Downloads xcopy Downloads/*.exe “C:\Users\username\AppData\Roaming\Microsoft\Windows\CurrentVersion\Explorer”

Once you have completed the installation, you will have new files in the /opt/maven directory, which contains all Maven executables and scripts for running Maven. ..

The install script has moved to the /usr/local/bin directory. ..

To run Maven, you should have a file named “bin” in /opt/maven/.

export PATH=/opt/maven/bin:$PATH

Copy and paste the following code into the file. This is a test.

Save and close the file when finished entering the content using the Ctrl + O keys, then confirm with the Enter and CTRL + X keys.

mvn -Dskip-dependencies -Dmaven.sh=/etc/profile.d/maven

If you want to install Maven, you can use the following command: mvn -version ..

Output: You should expect to see an output like the one below. ..

rm -rf apache-maven-3.8.2

mvn create -Dmaven.version=1.8.0 -Dmaven.plugin.dir=/usr/local/plugins -Dmaven.source=https://github.com/apache/maven-plugins This command creates a new Maven project from a template, using the 1.8.0 version of the Maven library and the plugin directory at /usr/local/plugins . The source file is https://github.com/apache/maven-plugins/.

Final note

This guide will show you how to configure and run Apache Maven on Debian 11 “Bullseye”. If you have any questions about this article, please feel free to ask us in the comments below. Additionally, if you’d like to share this guide with your friends, please do so by using the buttons below. ..