Reputation: 266
I need to have maven and Java an EC2 instance.
To install maven, I use:
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
To install Java 1.8 I use:
sudo yum install java-1.8.0-openjdk-devel
sudo yum remove java-1.7.0-openjdk
And then updating the environment variables:
export JAVA_HOME='/usr/lib/jvm/java-1.8.0-openjdk.x86_64'
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
The problem is that when I install Java 1.8 while maven is installed, maven is removed when Java 1.7 is removed, since it is a dependency of Java 1.7:
Removing for dependencies:
apache-maven noarch 3.3.9-1.el6 @epel-apache-maven 9.5 M
When I install Java maven while Java 1.8 is installed, Java 1.8 is replaced with Java 1.7:
Dependency Installed:
java-1.7.0-openjdk.x86_64 ...
How can I have both maven and Java 1.8 without them removing each other?
Upvotes: 0
Views: 754
Reputation: 3310
I will suggest below options for your answer:
Directly get the maven bin file and explode it to use it after java 8 installation as below:
wget http://www-eu.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
tar -xvzf {downloaded _maven_file} // Update the path variable
One can use sdkman to manage installation of java and maven.
Upvotes: 1