mvn compile in linux terminal does not have the same behaviour than Intellij compile goal in maven windows

i have a behaviour difference between :

  • mvn compile command in Linux terminal
  • mvn compile goal in Intellij IDEA/maven windows/goal compile

I detail below :

i know why i got an error in my Linux terminal (i forgot a maven compile version in my pom.xml) but this is not the problem. The problem is to understand why the two behaviours are not similar. So,in my linux terminal, i got an error (Compilation failure) when i ask to my terminal my maven version i got :

mvn --version 
==> /opt/apache-maven-3.6.3

Now, i got to Intellij in the menu

files/settings/build tools/maven/maven home path 

and i choose the proposed item whih is :


Then, i go to the Intellij/maven windows and i launch a compile goal. The build is successfull !

So, question is : why i don't have the same behaviour, as maven windows seems to use the same maven path execution ?

Perhaps the path execution of the maven windows goal isn't set from the menu ?

files/settings/build tools/maven/maven home path 

thanks by advance.


  • The maven version is not sufficient to solve the problem. The most important thing it the jdk version used by maven.

    In Intellij IDEA, it is configured here : settings | Build, Execution, Deployment | Build Tools | Maven | Runner

    There are multiple options here, and by specify this one :

    Use JAVA_HOME 

    i can be sure that the behaviour of my build in Intellij IDEA is the same as the build launched with the terminal command :

    mvn clean package 

    So, all is clear now.