{"id":269160,"date":"2022-08-12T10:17:22","date_gmt":"2022-08-12T09:17:22","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=ktor&#038;p=269160"},"modified":"2025-09-18T11:40:34","modified_gmt":"2025-09-18T10:40:34","slug":"ktor-2-1-0-released-and-it-comes-with-goodies","status":"publish","type":"ktor","link":"https:\/\/blog.jetbrains.com\/en\/ktor\/2022\/08\/12\/ktor-2-1-0-released-and-it-comes-with-goodies","title":{"rendered":"Ktor 2.1.0 Released and It Comes With Goodies!"},"content":{"rendered":"\n<p>We\u2019ve just released Ktor 2.1.0, and in addition to the <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/KTOR?u=1&amp;q=%23Resolved%20%232.1.0%20%20%23Feature%20\" target=\"_blank\" rel=\"noopener\">new features<\/a> and <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/KTOR?u=1&amp;q=%23Resolved%20%232.1.0%20%20%23Bug%20%20\" target=\"_blank\" rel=\"noopener\">bug fixes<\/a>, we have a few new things we\u2019d love for you to try out. In particular, we are releasing betas of three new tools:<\/p>\n\n\n\n<ul>\n<li>Command Line tool<\/li>\n\n\n\n<li>Yeoman Generator<\/li>\n\n\n\n<li>Gradle Deployment Plugin<\/li>\n\n\n\n<li>YAML configuration support<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s take a look at each of these individually.&nbsp;<\/p>\n\n\n\n<p><strong>Native Command Line Tool<\/strong><\/p>\n\n\n\n<p>Ktor provides two ways to simplify creating new application templates \u2013 <a href=\"https:\/\/ktor.io\/idea\/\" target=\"_blank\" rel=\"noopener\">IntelliJ IDEA<\/a>&nbsp;or <a href=\"https:\/\/start.ktor.io\/\" target=\"_blank\" rel=\"noopener\">start.ktor.io<\/a>.&nbsp;<\/p>\n\n\n\n<p>We\u2019ve now extended this by providing a command line tool built in Kotlin\/Native. However, beyond just generating a Ktor server application for you, it also takes care of downloading a JDK if your system does not have one installed.&nbsp;This is ideal for folks who are new to the JVM.<\/p>\n\n\n\n<p>To create a new project, simply type:<\/p>\n\n\n\n<p><code>ktor generate {projectName}<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/09\/OvcTaDLdI5T14aqNcI3rfuNNiACCU_1nE_T57pPjRBUN9RVFnZlV8ff6naRVyjfWgfCsUyv_WUFNkO2WhyglgrORpbRIqzoHYns0rEq1HlpiAej4AGd6Rint87zdkbJSXZl6he8kuo5xOOrYh2qncPY.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Once completed (which will also include downloading JDK\/Gradle if necessary), it will build the project.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/09\/u1Zn7iSIYFlawQU7Z80PYpHXbfAjskGxyr9fd5OMeua9KwXjYvRKSUv8YHTt7S_Xocg6xe5dU8Qnmigsie6FmlgWyc-LcA3nod-twnG7Ibzp_7NlYnZBylHuTuZxBW-6LsE63Bxfmujw-g0vgON2yM0.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>All that\u2019s left to do is run it!&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/09\/ebEVqVz39ghxsJOhpS83lczYBPdtNQLs373fzu2jQg3_kVU-TPS7jQcRlioXBor7cLsFcRns7pE2gVS_L_dhpY8IDHSMUUVtGJvrRgsYOU1bfiEAi3bF8dWjgl1Ke_GwGdNMaDiMgxP-T_z2qIEji40.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>The tool is currently available for macOS and Linux. Windows support will come later on.&nbsp;<\/p>\n\n\n\n<p>For macOS you can download it directly from the <a href=\"https:\/\/github.com\/ktorio\/ktor-cli\/releases\/tag\/2.1.0-beta-1\" target=\"_blank\" rel=\"noopener\">release page<\/a> or install it via brew with:<\/p>\n\n\n\n<p><code>brew tap ktorio\/ktor<\/code><\/p>\n\n\n\n<p><code>brew install --build-from-source ktor<\/code><\/p>\n\n\n\n<p>On Linux we\u2019re working on trying to get it published to Snap. In the meantime you can use the <a href=\"https:\/\/github.com\/ktorio\/ktor-cli\/releases\/tag\/2.1.0-beta-1\" target=\"_blank\" rel=\"noopener\">release page<\/a>.<\/p>\n\n\n\n<p>The command line tool does not currently provide the option to customize your project, but the next thing we\u2019re going to show you does!<\/p>\n\n\n\n<p><strong>Yeoman Generator<\/strong><\/p>\n\n\n\n<p>Similar to the command line client, we\u2019ve also added <a href=\"https:\/\/yeoman.io\/\" target=\"_blank\" rel=\"noopener\">Yeoman<\/a> support. Yeoman is a command line tool that allows you to easily generate scaffolding for a variety of projects. Ktor is now one of these!<\/p>\n\n\n\n<p>If you do not have Yeoman installed, make sure you first install <a href=\"https:\/\/nodejs.org\/\" target=\"_blank\" rel=\"noopener\">node\/npm<\/a> (compatible with versions above 14.0.0). Once you have that, you can run:<\/p>\n\n\n\n<p><code>npm install -g yo<\/code><\/p>\n\n\n\n<p>This installs Yeoman globally on your system. Next step is to install the Ktor generators:<\/p>\n\n\n\n<p><code>npm install -g generator-ktor<\/code><\/p>\n\n\n\n<p>Once installed, you can simply create a new project directory and run the generator using:<\/p>\n\n\n\n<p><code>yo ktor<\/code><\/p>\n\n\n\n<p>It will prompt you for a series of inputs:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/09\/hukd8NaIOXbEITdt58iUiQaLwvKQtzwjDdWZE2XXpmwBvzmfQwocZ4lYFkMKsJ0XXk-T-55nXmKLfebXgZnaIeCHplUTVmQGcyjJ4_3LIGNBPthr06MhkQiI7FO_Dx4t07xsbzQpYzAQgY8D9wt4Yrk.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Then it will generate the project. This time it will automatically run it for you, too!&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/09\/YS64dAFGwHpKmnN2_VOTSlvv2GNqp9AvWxWSAlYFMpH7CM0HrtdCimHotUNMobKhixH9MkT5v7quSwTJ68djbmiIL0B-Z8IRfqi4c7ej8IXXzj8PWXg5jiVYOmI5Q56kfe0daBBMI0Y3vM5PbW5P-I8.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>Gradle Deployment Plugin<\/strong><\/p>\n\n\n\n<p>One of our goals with Ktor is to make the overall development experience as smooth and enjoyable as possible. Of course, people rarely develop an application and do not deploy it.&nbsp;<\/p>\n\n\n\n<p>To this end, we\u2019ve recently released a beta of our new <a href=\"https:\/\/github.com\/ktorio\/ktor-build-plugins\" target=\"_blank\" rel=\"noopener\">Gradle plugin for deployment<\/a> (note that newly created projects using the wizards will add this plugin by default). You can now define how you would like your Ktor application to be deployed in a Gradle file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">ktor {\n    docker {\n        jreVersion.set(JreVersion.JRE_17)\n        localImageName.set(&quot;sample-docker-image&quot;)\n        imageTag.set(&quot;0.0.1-preview&quot;)\n\n        externalRegistry.set(\n            DockerImageRegistry.dockerHub(\n                appName = provider { &quot;ktor-app&quot; },\n                username = providers.environmentVariable(&quot;DOCKER_HUB_USERNAME&quot;),\n                password = providers.environmentVariable(&quot;DOCKER_HUB_PASSWORD&quot;)\n            )\n        )\n    }\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>The plugin provides several new tasks allowing you to build, run, and publish Docker images, as well as work with FatJars, with GraalVM native images in the works.&nbsp;<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">ktor {\n    fatJar {\n        archiveFileName.set(&quot;fat.jar&quot;)\n    }\n}<\/pre>\n\n\n\n<p>While it is currently only available for Gradle, the plan is to provide Maven support as well. For information about the list of tasks offered, check out the <a href=\"https:\/\/github.com\/ktorio\/ktor-build-plugins#readme\" target=\"_blank\" rel=\"noopener\">notes on GitHub<\/a>. You can also find more details in the Ktor documentation, both about <a href=\"https:\/\/ktor.io\/docs\/fatjar.html\" title=\"https:\/\/ktor.io\/docs\/fatjar.html\" target=\"_blank\" rel=\"noopener\">fat jars<\/a> and about <a href=\"https:\/\/ktor.io\/docs\/docker.html\" title=\"https:\/\/ktor.io\/docs\/docker.html\" target=\"_blank\" rel=\"noopener\">Docker<\/a>.<\/p>\n\n\n\n<p><strong>YAML configuration support<\/strong><\/p>\n\n\n\n<p>In addition to configuring Ktor applications using code or HOCON, you can now use YAML, which is also available for Ktor native server applications. Take the following HOCON configuration:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">ktor {\n    deployment {\n        port = 8080\n    }\n    application {\n        modules = &#091; com.example.ApplicationKt.module ]\n    }\n}<\/pre>\n\n\n\n<p>In YAML, the equivalent would be:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">ktor:\n    deployment:\n        port: 8080\n    application:\n        modules:\n            - com.example.ApplicationKt.module<\/pre>\n\n\n\n<p>You can find out more about YAML configuration in the <a href=\"https:\/\/ktor.io\/docs\/configurations.html#configuration-file\" target=\"_blank\" rel=\"noopener\">documentation<\/a>.<\/p>\n\n\n\n<p>We\u2019d love for you to try these new tools out and give us some feedback!&nbsp;<br><\/p>\n","protected":false},"author":1142,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","categories":[907],"tags":[],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/ktor\/269160"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/ktor"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/types\/ktor"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/users\/1142"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/comments?post=269160"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/ktor\/269160\/revisions"}],"predecessor-version":[{"id":629744,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/ktor\/269160\/revisions\/629744"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/media?parent=269160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/categories?post=269160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/tags?post=269160"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/en\/wp-json\/wp\/v2\/cross-post-tag?post=269160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}