Dataframe 0.14 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.14.1" } dependencies { implementation("org.jetbrains.kotlinx:dataframe:0.14.1") } // 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.14.1" } dependencies { implementation 'org.jetbrains.kotlinx:dataframe:0.14.1' } // 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.14.1") // Optional formats support implementation("org.jetbrains.kotlinx:dataframe-excel:0.14.1") implementation("org.jetbrains.kotlinx:dataframe-jdbc:0.14.1") implementation("org.jetbrains.kotlinx:dataframe-arrow:0.14.1") implementation("org.jetbrains.kotlinx:dataframe-openapi:0.14.1") }
dependencies { // Artifact containing all APIs and implementations implementation 'org.jetbrains.kotlinx:dataframe-core:0.14.1' // Optional formats support implementation 'org.jetbrains.kotlinx:dataframe-excel:0.14.1' implementation 'org.jetbrains.kotlinx:dataframe-jdbc:0.14.1' implementation 'org.jetbrains.kotlinx:dataframe-arrow:0.14.1' implementation 'org.jetbrains.kotlinx:dataframe-openapi:0.14.1' }

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: 27 September 2024