title: Vanilla SpringBoot app works in IntelliJ, but `mvn compile` fails
body: <p>When I create a vanilla SpringBoot app through the SpringBoot initializr option in IntelliJ, this creates a simple <code>DemoApplication.java</code> file:</p>
  <pre class="lang-java prettyprint-override"><code>package com.example.demo;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
      
  @SpringBootApplication
  public class DemoApplication {
    
      public static void main(String[] args) {
          SpringApplication.run(DemoApplication.class, args);
      }
      
  }
  </code></pre>
  <p>When I run <code>main</code> from IntelliJ it seems to work just fine (not that it does much right now):</p>
  <pre class="lang-java prettyprint-override"><code> .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v2.3.4.RELEASE)
  
  2020-09-20 13:03:52.377  INFO 7456 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on DESKTOP-5MKKIB9 with PID 7456 (C:\Users\jasonfil\code\demo\target\classes started by jasonfil in C:\Users\jasonfil\code\demo)
  2020-09-20 13:03:52.377  INFO 7456 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
  2020-09-20 13:03:52.824  INFO 7456 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.75 seconds (JVM running for 1.446)
  
  Process finished with exit code 0
  </code></pre>
  <p>but when I try to run <code>mvn compile</code> from the command line, I get a message about my compilation not being up to par:</p>
  <pre class="lang-sh prettyprint-override"><code>C:\Users\jasonfil\code\demo&gt;mvn compile
  [INFO] Scanning for projects...
  [INFO]
  [INFO] --------------------------&lt; com.example:demo &gt;--------------------------
  [INFO] Building demo 0.0.1-SNAPSHOT
  [INFO] --------------------------------[ jar ]---------------------------------
  [INFO]
  [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 1 resource
  [INFO] Copying 0 resource
  [INFO]
  [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to C:\Users\jasonfil\code\demo\target\classes
  [INFO] -------------------------------------------------------------
  [ERROR] COMPILATION ERROR :
  [INFO] -------------------------------------------------------------
  [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
  [INFO] 1 error
  [INFO] -------------------------------------------------------------
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  1.096 s
  [INFO] Finished at: 2020-09-20T13:57:26-04:00
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project demo: Compilation failure
  [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
  [ERROR]
  [ERROR] -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  'cmd' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  <p>IntelliJ provided me with a basic <code>pom.xml</code>, and I have <strong>not</strong> touched it:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.3.4.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;demo&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;demo&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                      &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p>I am working in a project that needs Amazon's Java 11 Corretto JDK. Considering that the project builds and runs, I'm under the impression that the JDK is viewed just fine. I have also tried with Oracle's JDK 14, without luck. Here's the IntelliJ specification under <code>Project Structure</code>:</p>
  <p><a href="https://i.stack.imgur.com/6GBIU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6GBIU.png" alt="Amazon Corretto JDK view from inside IntelliJ" /></a></p>
  <p>Lastly, seeing messages about <code>maven-compiler-plugin</code>, I also added</p>
  <pre class="lang-xml prettyprint-override"><code>  &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
    &lt;/dependency&gt;
  </code></pre>
  <p>to my <code>pom</code>. No luck there either, after refreshing maven, cleaning and then compiling again. Any ideas?</p>