boxen / puppet-java

Install Java
http://boxen.github.com
MIT License
13 stars 55 forks source link

Issues with Boxen Java and maven #51

Open petems opened 9 years ago

petems commented 9 years ago

So, I've been having a long standing issue with boxen and maven.

For example, I clone: https://github.com/scobal/seyren

I run mvn clean verify

I get:

exceptionGettingDataFromGraphiteIsHandled(com.seyren.core.util.graphite.GraphiteHttpClientTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0

All the things I'm reading are basically saying "You're pointing at the wrong version of java"

And someone then said "Check your maven bin script, it's probably setting $JAVA_HOME incorrectly"

So I look and I see this:

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true            
           #
           # Look for the Apple JDKs first to preserve the existing behaviour, and then look
           # for the new JDKs provided by Oracle.
           # 
           if [[ -z "$JAVA_HOME" && -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ]] ; then
             #
             # Apple JDKs
             #
             export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
           fi

           if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
             #
             # Apple JDKs
             #
             export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
           fi

           if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
             #
             # Oracle JDKs
             #
             export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
           fi           

           if [[ -z "$JAVA_HOME" && -x "/usr/libexec/java_home" ]] ; then
             #
             # Apple JDKs
             #
             export JAVA_HOME=/usr/libexec/java_home
           fi
           ;;
esac

Is there a way to fix how we set the java home so maven can work?

ghost commented 9 years ago

A well installed jdk framework under OSX seems to be linked via /Library/Java/JavaVirtualMachines/Home?

Where does CurrentJDK come from?

--  Julien Lavergne Sent with Airmail

On December 30, 2014 at 2:13:37 PM, Peter Souter (notifications@github.com) wrote:

So, I've been having a long standing issue with boxen and maven.

For example, I clone: https://github.com/scobal/seyren

I run mvn clean verify

I get:

exceptionGettingDataFromGraphiteIsHandled(com.seyren.core.util.graphite.GraphiteHttpClientTest) Time elapsed: 0 sec <<< ERROR! java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0

All the things I'm reading are basically saying "You're pointing at the wrong version of java"

And someone then said "Check your maven bin script, it's probably setting $JAVA_HOME incorrectly"

So I look and I see this:

OS specific support. $var must be set to either true or false.

cygwin=false; darwin=false; mingw=false case "uname" in CYGWIN) cygwin=true ;; MINGW) mingw=true;; Darwin*) darwin=true
#

Look for the Apple JDKs first to preserve the existing behaviour, and then look

       # for the new JDKs provided by Oracle.
       #  
       if [[ -z "$JAVA_HOME" && -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ]] ; then
         #
         # Apple JDKs
         #
         export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
       fi
       if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
         #
         # Apple JDKs
         #
         export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
       fi

       if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
         #
         # Oracle JDKs
         #
         export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
       fi            

       if [[ -z "$JAVA_HOME" && -x "/usr/libexec/java_home" ]] ; then
         #
         # Apple JDKs
         #
         export JAVA_HOME=/usr/libexec/java_home
       fi
       ;;

esac

Is there a way to fix how we set the java home so maven can work?

— Reply to this email directly or view it on GitHub.

petems commented 9 years ago

I dunno, that's all from the maven install done by default with brew...