gradle - IntelliJ在gradle中添加子项目依赖项很奇怪

标签 gradle intellij-idea dependencies build.gradle

我有一个gradle多项目。
“root”有2个子项目,分别命名为“domain”和“web”。 “网络”需要使用在“域”项目中声明的类。

但是,每当我将compile project(':domain')添加到“web”的依赖项中时。

Intellij说'root_main','root_test','web_main','web_test'不再从Gradle导入,我不想这么做。

您能告诉我如何将依赖项“域”添加到“网络”中吗?

结构如下:

root
├── build.gradle
├── domain
│   ├── build.gradle
│   └── src
│       └── main
│       └── test
│               
├── web
│   ├── build.gradle
│   └── src
│       └── main
│       └── test
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

根目录下的'build.gradle'
version '1.0-SNAPSHOT'

allprojects {
    group = 'com.sample.projects.multi'

    apply plugin: 'java'
    apply plugin: 'eclipse'

    sourceCompatibility = 1.8

    repositories {
        mavenCentral()
    }

    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
    }
}

域中的“build.gradle”
version '1.0-SNAPSHOT'

dependencies {
}

网络中的“build.gradle”
version '1.0-SNAPSHOT'

dependencies {
    compile project(':domain')
}

最佳答案

对于可能与我有相同问题的人,我通过将Intellij更新为较新的人来解决此问题。我的是2017.1,我将其更新为2018.1。

关于gradle - IntelliJ在gradle中添加子项目依赖项很奇怪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50404664/

相关文章:

java - False 无法 Autowiring Intellij 错误

linux - 无法安装依赖项

java - Google App Engine在Hello World应用程序中不起作用

java - 使用 Gradle 6 构建避免拆分包的附加工件

java - 在 IntelliJ 中找不到 TestNG

asp.net-mvc-3 - 添加可部署依赖项 - 缺少 MVC 复选框

android - 发现多个文件的操作系统独立路径为 'META-INF/DEPENDENCIES' 且无法合并 dex

android - 找不到最新版本的gradle

gradle - 找不到方法 lintChecks()

java - 有什么方法可以将 "this"关键字自动添加到Intellij Idea中的类字段中吗?