title: Kotlin, Spring-boot and Maven: Unresolved reference: SpringBootApplication
body: <p>I want to write a Kotlin application using Spring Boot.
  I wrote the following pom.xml file: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;groupId&gt; com.matan&lt;/groupId&gt;
  &lt;version&gt;0.0.1&lt;/version&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;artifactId&gt;spring-5-mvc&lt;/artifactId&gt;
  &lt;name&gt;spring-5-mvc&lt;/name&gt;
  &lt;description&gt;spring 5 MVC sample project about new features&lt;/description&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;properties&gt;
      &lt;jayway-rest-assured.version&gt;2.9.0&lt;/jayway-rest-assured.version&gt;
      &lt;jackson.version&gt;2.9.9&lt;/jackson.version&gt; &lt;!-- Same as spring-boot-dependencies:2.1.7.RELEASE --&gt;
      &lt;kotlin.version&gt;1.3.50&lt;/kotlin.version&gt; &lt;!-- Same as spring-boot-dependencies:2.1.7.RELEASE --&gt;
      &lt;start-class&gt;com.matan.Main&lt;/start-class&gt;
      &lt;httpclient.version&gt;4.5.8&lt;/httpclient.version&gt;
  &lt;/properties&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.2.1.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-validation&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- utils --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!--kotlin deps --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;artifactId&gt;kotlin-stdlib-jre8&lt;/artifactId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;artifactId&gt;kotlin-reflect&lt;/artifactId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.module&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-module-kotlin&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- runtime and test scoped --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&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;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.jayway.restassured&lt;/groupId&gt;
              &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
              &lt;version&gt;${jayway-rest-assured.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
          &lt;artifactId&gt;kotlin-stdlib-jdk8&lt;/artifactId&gt;
          &lt;version&gt;${kotlin.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
          &lt;artifactId&gt;kotlin-test&lt;/artifactId&gt;
          &lt;version&gt;${kotlin.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;sourceDirectory&gt;src/main/kotlin&lt;/sourceDirectory&gt;
      &lt;testSourceDirectory&gt;src/test/kotlin&lt;/testSourceDirectory&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;version&gt;2.2.1.RELEASE&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;kotlin-maven-plugin&lt;/artifactId&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;compilerPlugins&gt;
                      &lt;plugin&gt;spring&lt;/plugin&gt;
                  &lt;/compilerPlugins&gt;
                  &lt;jvmTarget&gt;1.8&lt;/jvmTarget&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;compile&lt;/id&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;test-compile&lt;/id&gt;
                      &lt;phase&gt;test-compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;test-compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
                      &lt;artifactId&gt;kotlin-maven-allopen&lt;/artifactId&gt;
                      &lt;version&gt;${kotlin.version}&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>I wrote the following Main class:</p>
  
  <pre><code>package com.matan;
  
  @SpringBootApplication
  class Main
  </code></pre>
  
  <p>and then I got the error: </p>
  
  <blockquote>
    <p>kotlin: Unresolved reference: SpringBootApplication</p>
  </blockquote>
  
  <p>Do you know what I'm doing wrong?</p>