How To Educate Specific Coffee Version For Maven Inwards Windows?

Maven is a neat construct tool in addition to most of the Java developer uses Maven to construct their projects, but similar whatever other tool, at that spot are or thence intricacies which you lot involve to know spell using it. One of them is that Maven uses Java version from the JAVA_HOME environs variable in addition to non the PATH environs variable. If you lot conduct keep multiple JDK installed on your machine in addition to getting an Unsupported major.minor version 51.0 or Unsupported major.minor version 52.0 fault spell edifice your projection but conduct keep right Java version inwards PATH in addition to then you lot may involve to cheque the JAVA_HOME in addition to update it. If you lot don't conduct keep access to practise it in addition to then you lot tin flame nevertheless alter JAVA_HOME using laid dominance inwards your local trounce in addition to run the Maven's mvn dominance to construct the project

This alter volition non touching on the entire machine in addition to become away every bit presently every bit you lot unopen the shell. I'll enjoin you lot how to that inwards this article.

Recently I got a adventure to piece of work amongst QuickFIXJ, an opened upward rootage library to parse in addition to procedure FIX messages. If you lot don't know the FIX, it stands for Financial Information Exchange protocol in addition to is used heavily for Electronic trading. If you lot are interested, you lot tin flame larn to a greater extent than almost the FIX inwards my serial of FIX tutorials.

I had a requirement to add together a custom FIX tag to parse incoming message in addition to for that, I involve to extend the FIX lexicon of QuickFIXJ (like a FIX44.xml file) in addition to construct the JAR file. In guild to practise that I cloned the latest loose of QuickFIX from GitHub in addition to started edifice using Maven, exclusively for the construct to endure failed.

I was getting "org/apache/maven/plugins/resources/ResourcesMojo : Unsupported major.minor version 51.0" fault which way Maven is using JDK 1.6 or lower to construct the projection but the projection needed Java 1.7 (See my article on UnsupportedClassVersion to larn more).

I was surprised yesteryear this fault because I was certain that I am using Java 1.8, which should endure plenty to construct the project. To confirm that I run next dominance inwards the dominance business window I was using to run Maven:

$ coffee -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b32)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b32, mixed mode)


And it was declaring the right Java version. Then I realized that when you lot type coffee on dominance prompt it alternative the JDK version from the PATH environs variable but Maven uses JAVA_HOME environs variable to alternative the JDK version to construct your projection in addition to run it's a plugin.

To confirm the JAVA_HOME, I checked the environs variable using "env" trounce dominance on Windows in addition to boom, it was pointing to JDK 1.6 which explains the error.

The solution was at nowadays easy, I only updated JAVA_HOME in addition to it worked fine. So, only retrieve that Maven doesn't operate PATH to alternative the Java version, instead, it uses JAVA_HOME variable.

If you lot are getting the Unsupported major.minor version 51.0 or Unsupported major.minor version 52.0 fault spell edifice your projection or whatever opened upward rootage projection using Maven, delight cheque the JAVA_HOME environs variable inwards your machine in addition to alter it to JDK 1.7 or JDK 1.8 depending upon the fault you lot are getting. You tin flame cheque The Complete Java Masterclass to larn to a greater extent than almost course of study files in addition to how Java plant inwards general.



How to specify Java Version for Maven inwards Command prompt

The solution was tardily inwards my illustration but 1 of my readers reported that he can't alter an environs variable inwards his PC without elevated access or calling to Desktop support, which happens mainly on a big organization similar Investment banks.

If you lot also stuck inwards a similar situation, don't worry. You tin flame nevertheless alter the JAVA_HOME environs variable inwards the local trounce you lot are running the maven dominance yesteryear using the "set" dominance every bit shown below:

$ laid JAVA_HOME=path-to-jdk-bin-directory


The alter volition endure temporary in addition to exclusively applicable to the trounce you lot are running. It volition non touching on your machine's JAVA_HOME settings in addition to volition become away every bit presently every bit you lot unopen the trounce or opened upward a novel shell.

This solution is actually prissy every bit you lot don't involve elevated access in addition to tin flame solve the occupation immediately. Btw, if you lot desire to larn almost Maven itself, I propose you lot accept a await at the Unsupported major.minor version 51.0 or Unsupported major.minor version 52.0 error spell edifice your projection or whatever opened upward rootage projection using Maven, delight cheque the JAVA_HOME environs variable inwards your machine in addition to alter it to JDK 1.7 or JDK 1.8 depending upon the fault you lot are getting.

For example, Unsupported major.minor version 51.0 way JAVA_HOME is pointing to JDK 1.6 or lower in addition to Maven using that to run it's compiler plugin to construct your projection in addition to that needs JDK vii or higher.  On the other manus Unsupported major.minor version 52.0 way JAVA_HOME is pointing to Java vii or lower in addition to you lot involve to alter it to signal to Java 8 or higher to run Maven successfully.


Further Learning
Maven Crash Course
answer)
  • How to growth the heap size of Maven? (steps)
  • How to prepare Maven Eclipse Dependency search non working issue? (solution)
  • How to install Maven inwards Windows 10? (steps)
  • How to construct a Java projection using ANT? (article)
  • How to practise or modify build.xm inwards ANT? (tutorial)
  • Top five Apache Maven Books for Free (books)
  • 10 Points almost Maven Java Developer should know (maven)
  • 10 Maven Plugins Every Java Developers should know (plugins)
  • 6 Free Maven in addition to Jenkins Courses for Java developers (courses)

  • Thanks for reading this article thence far. If you lot uncovering this article useful delight percentage amongst your friends in addition to colleagues. If you lot conduct keep whatever questions or feedback delight drib a note.

    1 Response to "How To Educate Specific Coffee Version For Maven Inwards Windows?"

    1. Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback. best kona coffee bean to buy in 2020

      ReplyDelete

    Iklan Atas Artikel

    Iklan Tengah Artikel 1

    Iklan Tengah Artikel 2

    Iklan Bawah Artikel