title: Kotlin + Maven can not find main class when running packaged jar
body: <p>I am trying to package(maven package) and run(java -jar file.jar) a project that contains both java and kotlin code. I have followed the tutorial at: <a href="https://michaelrice.com/2016/08/hello-world-with-kotlin-and-maven/" rel="noreferrer">https://michaelrice.com/2016/08/hello-world-with-kotlin-and-maven/</a></p>
  
  <p><code>kotlin source src/main/kotlin
  java source src/main/java</code></p>
  
  <p>the file I am trying to run is located in <code>src/main/kotlin/THEFILE.kt</code></p>
  
  <p>After succesfull packaging trying to run the jar I get an error <code>
  Error: Could not find or load main class THEFILEKt</code></p>
  
  <p>What can be the reason for this and how to fix it?</p>
  
  <p>Thanks in advance!!!</p>
  
  <p>Pom.xml includes a necessary kotlin plugins and dependency:</p>
  
  <pre><code>&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;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;plugin&gt;
              &lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
              &lt;artifactId&gt;kotlin-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;${kotlin.version}&lt;/version&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;configuration&gt;
                          &lt;sourceDirs&gt;
                              &lt;source&gt;src/main/java&lt;/source&gt;
                              &lt;source&gt;src/main/kotlin&lt;/source&gt;
                          &lt;/sourceDirs&gt;
                      &lt;/configuration&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;configuration&gt;
                  &lt;jvmTarget&gt;1.8&lt;/jvmTarget&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
  
                  &lt;execution&gt;
                      &lt;id&gt;default-compile&lt;/id&gt;
                      &lt;phase&gt;none&lt;/phase&gt;
                  &lt;/execution&gt;
  
                  &lt;execution&gt;
                      &lt;id&gt;default-testCompile&lt;/id&gt;
                      &lt;phase&gt;none&lt;/phase&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;java-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;java-test-compile&lt;/id&gt;
                      &lt;phase&gt;test-compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;testCompile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&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;testCompile&lt;/id&gt;
                      &lt;phase&gt;test-compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;testCompile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
  
  
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;mainClass&gt;
                              THEFILEKt
  
                          &lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
  
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;make-assembly&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;archive&gt;
                              &lt;manifest&gt;
                                  &lt;mainClass&gt;
                                      THEFILEKt
                                  &lt;/mainClass&gt;
                              &lt;/manifest&gt;
                          &lt;/archive&gt;
                          &lt;descriptorRefs&gt;
                              &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                          &lt;/descriptorRefs&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>