Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/tutorials/jvm-test/run-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorials/jvm-test/test-failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/kr.tree
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
<toc-element toc-title="Build a web application with Spring Boot and Kotlin – tutorial" href="https://spring.io/guides/tutorials/spring-boot-kotlin/"/>
<toc-element toc-title="Create a chat application with Kotlin Coroutines and RSocket – tutorial" href="https://spring.io/guides/tutorials/spring-webflux-kotlin-rsocket/"/>
</toc-element>
<toc-element topic="jvm-test-using-junit.md"/>
<toc-element topic="mixing-java-kotlin-intellij.md"/>
<toc-element topic="mixing-java-kotlin-intellij.md" toc-title="Add Kotlin to a Java project"/>
<toc-element topic="jvm-test-using-junit.md" toc-title="Test Java code with Kotlin"/>
<toc-element topic="jvm-records.md"/>
<toc-element toc-title="Java to Kotlin migration guides">
<toc-element toc-title="Strings" topic="java-to-kotlin-idioms-strings.md"/>
Expand Down
206 changes: 206 additions & 0 deletions docs/snippets/jvm-test-tutorial/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-junit-complete</artifactId>
<version>1.0-SNAPSHOT</version>

<name>kotlin-junit-complete</name>
<url>https://kotlinlang.org/docs/jvm-test-using-junit.htm</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<jexer.version>1.6.0</jexer.version>
<kotlin.version>%kotlinVersion%</kotlin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- JUnit Jupiter engine is required at test runtime -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<!-- Optionally: parameterized tests support -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<!-- Kotlin standard library needed to compile/run Kotlin tests -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gitlab.klamonte</groupId>
<artifactId>jexer</artifactId>
<version>${jexer.version}</version>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.1</version>
</plugin>

<!-- KOTLIN -->
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<extensions>true
</extensions> <!-- You can set this option to automatically take information about lifecycles -->
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal> <!-- You can skip the <goals> element if you enable extensions for the plugin -->
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal> <!-- You can skip the <goals> element if you enable extensions for the plugin -->
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<executions>
<!-- Replacing default-compile as it is treated specially by Maven -->
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<!-- Replacing default-testCompile as it is treated specially by Maven -->
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Activate Kotlin compiler for main and test sources -->
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion docs/topics/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ the ability to write expressive code as well as facilitating creation of DSL.
Yes. Kotlin is 100% interoperable with the Java programming language, and major emphasis has been placed on making sure
that your existing codebase can interact properly with Kotlin. You can easily [call Kotlin code from Java](java-to-kotlin-interop.md) and [Java code
from Kotlin](java-interop.md). This makes adoption much easier and lower-risk. There's also an automated [Java-to-Kotlin converter built
into the IDE](mixing-java-kotlin-intellij.md#converting-an-existing-java-file-to-kotlin-with-j2k) that simplifies migration of existing code.
into the IDE](mixing-java-kotlin-intellij.md#convert-java-files-to-kotlin) that simplifies migration of existing code.

### What can I use Kotlin for?

Expand Down
13 changes: 7 additions & 6 deletions docs/topics/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ Here you'll learn how to develop a console application and create unit tests wit

</tab>

<tab id="backend" title="Backend">
<tab id="backend" title="Server-side">

Here you'll learn how to develop a backend application with Kotlin server-side.
Here you'll learn how to develop backend applications with Kotlin server-side.

1. **Create your first backend application:**
1. **[Configure a Java project to work with Kotlin](mixing-java-kotlin-intellij.md)**.

* [Create a RESTful web service with Spring Boot](jvm-get-started-spring-boot.md)
* [Create HTTP APIs with Ktor](https://ktor.io/docs/creating-http-apis.html)
2. **[Add Kotlin tests to your Java Maven project](jvm-test-using-junit.md)**.

2. **[Learn how to mix Kotlin and Java code in your application](mixing-java-kotlin-intellij.md).**
3. **[Create a RESTful web service with Spring Boot](jvm-get-started-spring-boot.md)**.

4. **[Create HTTP APIs with Ktor](https://ktor.io/docs/creating-http-apis.html)**.

</tab>

Expand Down
2 changes: 1 addition & 1 deletion docs/topics/jvm/java-to-kotlin-collections-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ fun main() {

* Visit [Kotlin Koans](koans.md) – complete exercises to learn Kotlin syntax. Each exercise is created as a failing unit test and your job is to make it pass.
* Look through other [Kotlin idioms](idioms.md).
* Learn how to convert existing Java code to Kotlin with the [Java to Kotlin converter](mixing-java-kotlin-intellij.md#converting-an-existing-java-file-to-kotlin-with-j2k).
* Learn how to convert existing Java code to Kotlin with the [Java to Kotlin converter](mixing-java-kotlin-intellij.md#convert-java-files-to-kotlin).
* Discover [collections in Kotlin](collections-overview.md).

If you have a favorite idiom, we invite you to share it by sending a pull request.
2 changes: 1 addition & 1 deletion docs/topics/jvm/java-to-kotlin-idioms-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,6 @@ Learn more about [multiline strings](coding-conventions.md#strings).

* Look through other [Kotlin idioms](idioms.md).
* Learn how to convert existing Java code to Kotlin with
the [Java to Kotlin converter](mixing-java-kotlin-intellij.md#converting-an-existing-java-file-to-kotlin-with-j2k).
the [Java to Kotlin converter](mixing-java-kotlin-intellij.md#convert-java-files-to-kotlin).

If you have a favorite idiom, we invite you to share it by sending a pull request.
2 changes: 1 addition & 1 deletion docs/topics/jvm/java-to-kotlin-nullability-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ This version replaces the `if` expression with the [safe call operator](null-saf
## What's next?

* Browse other [Kotlin idioms](idioms.md).
* Learn how to convert existing Java code to Kotlin with the [Java-to-Kotlin (J2K) converter](mixing-java-kotlin-intellij.md#converting-an-existing-java-file-to-kotlin-with-j2k).
* Learn how to convert existing Java code to Kotlin with the [Java-to-Kotlin (J2K) converter](mixing-java-kotlin-intellij.md#convert-java-files-to-kotlin).
* Check out other migration guides:
* [Strings in Java and Kotlin](java-to-kotlin-idioms-strings.md)
* [Collections in Java and Kotlin](java-to-kotlin-collections-guide.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/jvm/jvm-spring-boot-using-crudrepository.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Get your personal language map to help you navigate Kotlin features and track yo
</a>

* Learn more about [Calling Java from Kotlin code](java-interop.md) and [Calling Kotlin from Java code](java-to-kotlin-interop.md).
* Learn how to convert existing Java code to Kotlin with the [Java-to-Kotlin converter](mixing-java-kotlin-intellij.md#converting-an-existing-java-file-to-kotlin-with-j2k).
* Learn how to convert existing Java code to Kotlin with the [Java-to-Kotlin converter](mixing-java-kotlin-intellij.md#convert-java-files-to-kotlin).
* Check out our Java to Kotlin migration guides:
* [Strings in Java and Kotlin](java-to-kotlin-idioms-strings.md).
* [Collections in Java and Kotlin](java-to-kotlin-collections-guide.md).
Expand Down
Loading