为什么intelliJ IDEA依赖关系范围是“提供的”而不是“编译”? [英] Why intelliJ IDEA dependency scope is "provided" instead of "compile"?
问题描述
我希望IntelliJ IDEA将我的库作为编译范围而不是提供范围。这是我的gradle文件的一部分:
apply plugin:'java'
sourceCompatibility = 1.8
存储库{
mavenCentral()
}
依赖关系{
//记录
编译'ch.qos.logback :logback-classic:1.2.1'
compile'com.getsentry.raven:raven-logback:7.8.2'
// BigQuery
compile'com.google。 api-client:google-api-client:1.20.0'
compile'com.google.apis:google-api-services-bigquery:v2-rev227-1.20.0'
//配置管理
编译'commons-configuration:commons-configuration:1.10'
// Json
编译'org.json:json:20160810'
// Kafka
编译org.apache.kafka:kafka-clients:0.10.1.1
testCompile组:'junit',名称:'junit',版本:' 4.12'
testCompile'org.assertj:assertj-core:3.0.0'
testCompile'org.mockito:mockito-all:1.10.19'
任务包装(类型:包装){
gradleVersion ='3.4'
}
$ b $ 范围总是回复到依赖项标签中的提供,这非常烦人:
我正在运行:
IntelliJ IDEA 2016.3.4
Build#IC-163.12024.16,建于1月31,2017
JRE:1.8.0_112-release-408-b6 x86_64
这是IntelliJ中的一个已知问题特定于Gradle 3.4的IDEA:
- IDEA-167412 Gradle 3.4-rc-1将编译依赖关系改为提供
- 具有更多细节的Gradle项目中的原始错误报告
- < ahref =https://youtrack.jetbrains.com/issue/IDEA-168716#comment=27-1954205rel =noreferrer>来自责任开发者的评论关于为每个源集创建模块选项以及Gradle集成如何在IntelliJ IDEA中工作
它已经在 2017.1 EAP build 。
您可以使用Gradle 3.3或更早版本作为解决方法,直到IDEA 2017.1发布。
I would like IntelliJ IDEA to have my libraries as "compile" scope instead of "provided" scope. This is a part of my gradle file:
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
// Logging
compile 'ch.qos.logback:logback-classic:1.2.1'
compile 'com.getsentry.raven:raven-logback:7.8.2'
// BigQuery
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.apis:google-api-services-bigquery:v2-rev227-1.20.0'
// Configuration management
compile 'commons-configuration:commons-configuration:1.10'
//Json
compile 'org.json:json:20160810'
//Kafka
compile "org.apache.kafka:kafka-clients:0.10.1.1"
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'org.assertj:assertj-core:3.0.0'
testCompile 'org.mockito:mockito-all:1.10.19'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.4'
}
The scope always reverts to "provided" in the dependency tab which is very annoying:
I am running: IntelliJ IDEA 2016.3.4 Build #IC-163.12024.16, built on January 31, 2017 JRE: 1.8.0_112-release-408-b6 x86_64
It's a known issue in IntelliJ IDEA that is specific to Gradle 3.4:
- IDEA-167412 Gradle 3.4-rc-1 changes compile dependencies to provided
- original bug report in the Gradle project with more details
- comment from the responsible developer regarding "Create Module per source set" option and how Gradle integration works in IntelliJ IDEA
It's already fixed in 2017.1 EAP build.
You can use Gradle 3.3 or older as a workaround until IDEA 2017.1 is released.
这篇关于为什么intelliJ IDEA依赖关系范围是“提供的”而不是“编译”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!