title: Include maven dependencies built with Java9 or Java10 in a Kotlin project
body: <p>Is it possible to include Java9 (or 10) dependencies? As Kotlin is only able to compile to Java 8 so far. I'm getting an <code>java.lang.UnsupportedClassVersionError</code> error obviously stating that a class in the JAR/dependency I'm including has been compiled by a more recent version of the Java Runtime. However am I not able to specify a newer JDK, which is able to run classes compiled with older versions (the Kotlin stuff?).</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.7.0&lt;/version&gt;
    &lt;configuration&gt;
      &lt;release&gt;9&lt;/release&gt;
      &lt;source&gt;${maven.compiler.source}&lt;/source&gt;
      &lt;target&gt;${maven.compiler.target}&lt;/target&gt;
      &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
    &lt;/configuration&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.ow2.asm&lt;/groupId&gt;
        &lt;artifactId&gt;asm&lt;/artifactId&gt;
        &lt;version&gt;6.1&lt;/version&gt; &lt;!-- Use newer version of ASM --&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>With the properties</p>
  
  <pre><code>&lt;maven.compiler.source&gt;9&lt;/maven.compiler.source&gt;
  &lt;maven.compiler.target&gt;9&lt;/maven.compiler.target&gt;
  </code></pre>
  
  <p>But now I'm getting the error:
  <code>"Error:Kotlin: Unknown JVM target version: 1.9
  Supported versions: 1.6, 1.8"</code></p>
  
  <p>Kotlin version is <code>1.2.41</code>, so far I can always switch to the newest version until it's released...</p>
  
  <p>It's okay with the following XML fragment. However the problem with <code>java.lang.UnsupportedClassVersionError</code> remains.</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;9&lt;/source&gt;
                  &lt;target&gt;9&lt;/target&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;!-- Replacing default-compile as it is treated specially by maven --&gt;
                  &lt;execution&gt;
                      &lt;id&gt;default-compile&lt;/id&gt;
                      &lt;phase&gt;none&lt;/phase&gt;
                  &lt;/execution&gt;
                  &lt;!-- Replacing default-testCompile as it is treated specially by maven --&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;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>I'm trying to build a Kotlin module/maven bundle for a (currently) Java9 project of mine.</p>
  
  <p>The Maven-Kotlin Plugin configuration is:</p>
  
  <pre><code>      &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;configuration&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;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;configuration&gt;
                          &lt;sourceDirs&gt;
                              &lt;source&gt;src/test/java&lt;/source&gt;
                              &lt;source&gt;src/test/kotlin&lt;/source&gt;
                          &lt;/sourceDirs&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>My whole pom.xml:</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;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;restful-web&lt;/groupId&gt;
      &lt;artifactId&gt;restful-web&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;kotlin.version&gt;1.2.41&lt;/kotlin.version&gt;
          &lt;kotlin.compiler.jvmTarget&gt;1.8&lt;/kotlin.compiler.jvmTarget&gt;
          &lt;sirix.version&gt;0.8.9-SNAPSHOT&lt;/sirix.version&gt;
          &lt;main.verticle&gt;org.sirix.rest.SirixVerticle&lt;/main.verticle&gt;
          &lt;maven.compiler.source&gt;9&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;9&lt;/maven.compiler.target&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.vertx&lt;/groupId&gt;
              &lt;artifactId&gt;vertx-core&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.vertx&lt;/groupId&gt;
              &lt;artifactId&gt;vertx-web&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.vertx&lt;/groupId&gt;
              &lt;artifactId&gt;vertx-lang-kotlin&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
          &lt;/dependency&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;com.github.sirixdb.sirix&lt;/groupId&gt;
              &lt;artifactId&gt;sirix-core&lt;/artifactId&gt;
              &lt;version&gt;${sirix.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.github.sirixdb.sirix&lt;/groupId&gt;
              &lt;artifactId&gt;sirix-xquery&lt;/artifactId&gt;
              &lt;version&gt;${sirix.version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.5.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${maven.compiler.source}&lt;/source&gt;
                      &lt;target&gt;${maven.compiler.target}&lt;/target&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;!-- Replacing default-compile as it is treated specially by maven --&gt;
                      &lt;execution&gt;
                          &lt;id&gt;default-compile&lt;/id&gt;
                          &lt;phase&gt;none&lt;/phase&gt;
                      &lt;/execution&gt;
                      &lt;!-- Replacing default-testCompile as it is treated specially by maven --&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;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;shade&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;transformers&gt;
                                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                      &lt;manifestEntries&gt;
                                          &lt;Main-Class&gt;io.vertx.core.Launcher&lt;/Main-Class&gt;
                                          &lt;Main-Verticle&gt;${main.verticle}&lt;/Main-Verticle&gt;
                                      &lt;/manifestEntries&gt;
                                  &lt;/transformer&gt;
                                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;
                                      &lt;resource&gt;META-INF/services/io.vertx.core.spi.VerticleFactory&lt;/resource&gt;
                                  &lt;/transformer&gt;
                              &lt;/transformers&gt;
                              &lt;artifactSet&gt;
                              &lt;/artifactSet&gt;
                              &lt;outputFile&gt;${project.build.directory}/${project.artifactId}-${project.version}-fat.jar&lt;/outputFile&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&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;configuration&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;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;configuration&gt;
                              &lt;sourceDirs&gt;
                                  &lt;source&gt;src/test/java&lt;/source&gt;
                                  &lt;source&gt;src/test/kotlin&lt;/source&gt;
                              &lt;/sourceDirs&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;kotlin-bintray&lt;/id&gt;
              &lt;name&gt;Kotlin Bintray&lt;/name&gt;
              &lt;url&gt;http://dl.bintray.com/kotlin/kotlin-dev&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/releases&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;sonatype-nexus-snapshots&lt;/id&gt;
              &lt;name&gt;Sonatype Nexus Snapshots&lt;/name&gt;
              &lt;url&gt;https://oss.sonatype.org/content/repositories/snapshots&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/releases&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>The error message / relevant part of the stacktrace is:</p>
  
  <p><code>java.lang.UnsupportedClassVersionError: org/sirix/access/conf/DatabaseConfiguration has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0</code></p>