Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing maven2 without openjdk

Tags:

by default ubuntu comes with openjdk. I installed jdk from sun, and removed openjdk, but with openjdk I had to remove maven2. How can I reinstall it without installing openjdk?

~$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Server VM (build 22.1-b02, mixed mode)

~$ sudo apt-get install maven2
(...)
The following extra packages will be installed:
(...)
openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
  openjdk-6-jre-lib
(...)
The following NEW packages will be installed:
(...)
openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
  openjdk-6-jre-lib

Any help appreciated, I have googled a lot and I haven't found any solution :/

like image 605
Adam Pierzchała Avatar asked Mar 01 '12 15:03

Adam Pierzchała


People also ask

Can we install Maven without Java?

Maven is the most widely used build and project dependency management tool for Java-based applications. We can install Maven on Mac OS using a package manager such as HomeBrew or through XCode Command Line Tools. But, in this tutorial, we will learn how to install Maven on Mac OS without using any other software.

What is Maven Ubuntu?

Apache Maven is an open-source utility that enables you to automate the development procedure of Java projects. It can also be utilized for Ruby, C#, and other programming languages. In Linux-based systems such as Ubuntu 22.04, Apache Maven is a well-known tool for developing projects related to Java.


1 Answers

You can simply download tar.gz archive from Maven web-site and unpack it to some directory like this (will unpack it to /opt):

tar -xzvf apache-maven-3.0.4-bin.tar.gz -C /opt

After it you need to set $M2_HOME variable:

export M2_HOME=<path_to_maven>

And add it to PATH:

export PATH=$PATH:$M2_HOME/bin

To check you can launch:

mvn -version

Note: If it does not work for all the terminals. Performed the below steps. Become superuser.

Fire below commands.

nano /etc/profile.d/maven.sh

Paste the below lines.

export M2_HOME=<path_to_maven>

export PATH=$PATH:$M2_HOME/bin

ctrl +O to save and ctrl +X to exit.

Fire the below commands.

chmod +x /etc/profile.d/maven.sh

source /etc/profile.d/maven.sh

mvn -version
like image 154
Andrew Logvinov Avatar answered Dec 09 '22 06:12

Andrew Logvinov