Kotlin 需要 Gradle 构建的库
Kotlin Require Library with Gradle Build
我正在尝试将库 Exposed to my project. So, it leads me to the bintray page 添加到它说要使用 compile 'org.jetbrains.exposed:exposed:0.8.5'
的地方。我打开文件 build.gradle
并将该文件放入 dependencies
段:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
IntelliJ 自动构建它,我收到以下错误
Warning:root project 'DB-Table-To-Orm': Unable to build Kotlin
project configuration Details:
java.lang.reflect.InvocationTargetException: null Caused by:
org.gradle.api.artifacts.ResolveException: Could not resolve all
dependencies for configuration ':compileClasspath'. Caused by:
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not
find org.jetbrains.exposed:exposed:0.8.5. Searched in the following
locations:
https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.pom
https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.jar
Required by:
project :
所以,我查看 in the repo 并没有超出 jetbrains
和 exposed
目录的路径。
如何使用 Gradle 安装 Exposed 库?他们的路径写错了吗?我应该在项目中提交错误报告吗?还是我只是将 compile
语句放在了错误的位置?
抱歉,如果这看起来像是一个愚蠢的请求,我是 Javaland
、Kotlin
和 IntelliJ
的新手。为 .NET
世界而来。
更新
这是 build.gradle
的完整内容:
group 'com.awebsite.db-table-to-orm'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
据我所知,Exposed 不在主要的 bintray 存储库(又名 jcenter)中。要在 Exposed 的仓库中进行 gradle 搜索,您需要添加以下内容:
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
到您的 repositories
部分。
示例:
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
然后重建它应该可以正常工作
我正在尝试将库 Exposed to my project. So, it leads me to the bintray page 添加到它说要使用 compile 'org.jetbrains.exposed:exposed:0.8.5'
的地方。我打开文件 build.gradle
并将该文件放入 dependencies
段:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
IntelliJ 自动构建它,我收到以下错误
Warning:root project 'DB-Table-To-Orm': Unable to build Kotlin project configuration Details: java.lang.reflect.InvocationTargetException: null Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileClasspath'. Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.exposed:exposed:0.8.5. Searched in the following locations: https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.pom https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.jar Required by: project :
所以,我查看 in the repo 并没有超出 jetbrains
和 exposed
目录的路径。
如何使用 Gradle 安装 Exposed 库?他们的路径写错了吗?我应该在项目中提交错误报告吗?还是我只是将 compile
语句放在了错误的位置?
抱歉,如果这看起来像是一个愚蠢的请求,我是 Javaland
、Kotlin
和 IntelliJ
的新手。为 .NET
世界而来。
更新
这是 build.gradle
的完整内容:
group 'com.awebsite.db-table-to-orm'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
据我所知,Exposed 不在主要的 bintray 存储库(又名 jcenter)中。要在 Exposed 的仓库中进行 gradle 搜索,您需要添加以下内容:
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
到您的 repositories
部分。
示例:
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
然后重建它应该可以正常工作