Dataframe 0.15 Help

Get started with Kotlin DataFrame on Gradle with custom configuration

Gradle

The Kotlin DataFrame library is published to Maven Central, so you can add the following line to your Kotlin DSL buildscript to depend on it:

General configuration

plugins { id("org.jetbrains.kotlinx.dataframe") version "0.15.0" } dependencies { implementation("org.jetbrains.kotlinx:dataframe:0.15.0") } // Below only applies to Android projects android { defaultConfig { minSdk = 26 // Android O+ } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } packaging { resources { pickFirsts += listOf( "META-INF/AL2.0", "META-INF/LGPL2.1", "META-INF/ASL-2.0.txt", "META-INF/LICENSE.md", "META-INF/NOTICE.md", "META-INF/LGPL-3.0.txt", ) excludes += listOf( "META-INF/kotlin-jupyter-libraries/libraries.json", "META-INF/{INDEX.LIST,DEPENDENCIES}", "{draftv3,draftv4}/schema", "arrow-git.properties", ) } } } tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "1.8" }
plugins { id "org.jetbrains.kotlinx.dataframe" version "0.15.0" } dependencies { implementation 'org.jetbrains.kotlinx:dataframe:0.15.0' } // Below only applies to Android projects android { defaultConfig { minSdk 26 // Android O+ } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } packaging { resources { pickFirsts += [ "META-INF/AL2.0", "META-INF/LGPL2.1", "META-INF/ASL-2.0.txt", "META-INF/LICENSE.md", "META-INF/NOTICE.md", "META-INF/LGPL-3.0.txt", ] excludes += [ "META-INF/kotlin-jupyter-libraries/libraries.json", "META-INF/{INDEX.LIST,DEPENDENCIES}", "{draftv3,draftv4}/schema", "arrow-git.properties", ] } } } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions.jvmTarget = "1.8" }

Note that it's better to use the same version for a library and plugin to avoid unpredictable errors. After plugin configuration, you can try it out, for example.

Custom configuration

If you want to avoid adding unnecessary dependencies, you can choose from the following artifacts:

dependencies { // Artifact containing all APIs and implementations implementation("org.jetbrains.kotlinx:dataframe-core:0.15.0") // Optional formats support implementation("org.jetbrains.kotlinx:dataframe-excel:0.15.0") implementation("org.jetbrains.kotlinx:dataframe-jdbc:0.15.0") implementation("org.jetbrains.kotlinx:dataframe-arrow:0.15.0") implementation("org.jetbrains.kotlinx:dataframe-openapi:0.15.0") // This artifact is only needed to directly call functions that generate @DataSchema code from OpenAPI specifications // It's used by Gradle and KSP plugins internally. // Your project needs dataframe-openapi to use generated code implementation("org.jetbrains.kotlinx:dataframe-openapi-generator:0.15.0") }
dependencies { // Artifact containing all APIs and implementations implementation 'org.jetbrains.kotlinx:dataframe-core:0.15.0' // Optional formats support implementation 'org.jetbrains.kotlinx:dataframe-excel:0.15.0' implementation 'org.jetbrains.kotlinx:dataframe-jdbc:0.15.0' implementation 'org.jetbrains.kotlinx:dataframe-arrow:0.15.0' implementation 'org.jetbrains.kotlinx:dataframe-openapi:0.15.0' implementation 'org.jetbrains.kotlinx:dataframe-openapi-generator:0.15.0' }

Linter configuration

We provide a Gradle plugin that generates interfaces with your data. If you're using any sort of linter, it might complain about them generated sources.

Use a configuration similar to this to prevent your linter from complaining about the formatting of the generated sources.

// Exclusions for `kotlinter`, if you use it: tasks.withType<org.jmailen.gradle.kotlinter.tasks.LintTask> { exclude { it.name.endsWith(".Generated.kt") } exclude { it.name.endsWith("\$Extensions.kt") } }
// Exclusions for `kotlinter`, if you use it: tasks.withType(org.jmailen.gradle.kotlinter.tasks.LintTask).all { exclude { it.name.endsWith(".Generated.kt") } exclude { it.name.endsWith("\$Extensions.kt") } }
[{**/*.Generated.kt,**/*$Extensions.kt}] ktlint = disabled
Last modified: 09 December 2024