Dependencies and plugins

In addition to the normal dependencies in a Java Spring Boot project, there are two additional dependencies in pom.xml

    <dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>

The following are a couple of important things to note:

  • kotlin-stdlib-jre8 is the standard library supporting the new JDK APIs added in Java 8
  • kotlin-reflect is the runtime component for using reflection features on a Java platform

In addition to spring-boot-maven-plugin, kotlin-maven-plugin is added in as a plugin in pom.xml. kotlin-maven-plugin compiles Kotlin sources and modules. This plugin is configured to be used during the compile and test-compile phases. The following piece of code shows the details:

    <plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
<jvmTarget>1.8</jvmTarget>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset