title: Mutual dependency of maven and java 1.7 doesn't allow installing maven with Java 1.8
body: <p>I need to have maven and Java an EC2 instance.</p>
  
  <p>To install maven, I use:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>To install Java 1.8 I use:</p>
  
  <pre><code>sudo yum install java-1.8.0-openjdk-devel
  sudo yum remove java-1.7.0-openjdk
  </code></pre>
  
  <p>And then updating the environment variables:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>Removing for dependencies:
  apache-maven                               noarch                   3.3.9-1.el6                                      @epel-apache-maven                   9.5 M
  </code></pre>
  
  <p>When I install Java maven while Java 1.8 is installed, Java 1.8 is replaced with Java 1.7:</p>
  
  <pre><code>Dependency Installed:
  java-1.7.0-openjdk.x86_64 ...
  </code></pre>
  
  <p>How can I have both maven and Java 1.8 without them removing each other?</p>