简体   繁体   中英

Cannot use Apache Commons-IO in Kotlin

I'm writing a CLI application, using the default template from IntelliJ IDEA.

I installed commons-io 2.8 , by searching for commons-io in the "From Maven" box.

在此处输入图像描述

However, IntelliJ can't find it. For example, I was looking for CountingInputStream , which can be imported by:

import org.apache.commons.io.input.CountingInputStream

But the import fails at .io .

Your project is seem to be a Gradle one. Gradle based projects can't add Maven depedencies to their libraries.

Consider adding your library to Gradle build script.

If you use Groovy DSL, add to your build-script the following code (or combine with existing scopes):

repositories {
    mavenCentral()
}

dependencies {
    implementation 'commons-io:commons-io:jar:2.8.0'
}

If you use Kotlin DSL, add to your build-script the following code (or combine with existing scopes):

repositories {
    mavenCentral()
}

dependencies {
    implementation("commons-io:commons-io:jar:2.8.0")
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM