0

my java version is jdk 1.7 .but maven uses jdk 1.6

java -version java version "1.7.0_55"

mvn --version gives Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.6.0_31, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre Default locale: en_IN, platform encoding: UTF-8 OS name: "linux", version: "3.8.0-37-generic", arch: "amd64", family: "unix"

I am getting BUILD failer when I try mvn clean install..What have to do??.

There are two version of java installed in my system.java 1.7 and java 1.6.But when I install maven it comes with java 1.6.how can I install maven with java 1.7.

java --version gives

java version "1.7.0_55"

sree
  • 93
  • 2
  • 13
  • Please check http://stackoverflow.com/questions/19654557/how-to-set-specific-java-version-to-maven – M A Jun 13 '14 at 11:02
  • You need to use both the correct JDK and ensure the compiler plugin has the source and target properties set to 1.7. Please include the console output so we can see exactly what's happing – Nick Holt Jun 13 '14 at 11:08
  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack-dependencies (get-test-data) on project neo4j-spatial: Error unpacking file: /home/power/.m2/repository/org/neo4j/spatial/osm-test-data/20100819/osm-test-data-20100819.jar to: /home/dev237/Projects/esplorio-web-master/spatial/target [ERROR] org.codehaus.plexus.archiver.ArchiverException: Error while expanding /home/power/.m2/repository/org/neo4j/spatial/osm-test-data/20100819/osm-test-data-20100819.jar: Negative seek offset and at last it gives build failer – sree Jun 13 '14 at 11:13
  • How to clean..please specific..I am getting many warnings and some errors,..java.io.IOException: Negative seek offset eror also.. – sree Jun 13 '14 at 11:17
  • what does javac -version shows ? – Bilbo Baggins Jun 13 '14 at 12:02
  • javac -version shows javac 1.6.0_31.I am using netbeans IDE – sree Jun 13 '14 at 12:05
  • Why do you think that error is caused by the version of the JDK you're using? – Nick Holt Jun 13 '14 at 12:58

2 Answers2

0

Java on your path is probably different from the JAVA_HOME environment property. See this answer

Community
  • 1
  • 1
Kafkaesque
  • 1,233
  • 9
  • 13
0

Maven uses JAVA_HOME parameter to find which Java version it is supposed to run.

You can set the JAVA_HOME parameter just before you start maven (and change it back afterwards if need be).
You could also go into your mvn(non-windows)/mvn.bat(windows) and set your java version explicitly there.
  • I am using ubuntu..I used to java_home to jdk 1.7..but it does not worked – sree Jun 13 '14 at 11:38
  • JAVA_HOME=java-7-oracle /usr/lib/jvm/java-7-oracle This is what I did in bashrc file..anything else I sjould do??? – sree Jun 13 '14 at 11:40
  • open your "mvn" file in maven installation directory, Add the location of your java installation there for the variable JAVA Home variable – Rajarshi Goswami Jun 13 '14 at 11:56