I'm having troubles in my project within Intellij Idea. Ive added a picture at the end of this to clarify what I need help with better just in case.
It seems that this line in build.gradle allows for one part of my project to be imported correctly:
dependencies {
implementation project(':cachetool')
}
However, when I run the application, I get the following from having that line:
Circular dependency between the following tasks:
:cachetool:classes
\--- :cachetool:compileJava
+--- :cachetool:compileKotlin
| \--- :cachetool:jar
| +--- :cachetool:classes (*)
| +--- :cachetool:compileKotlin (*)
| \--- :cachetool:inspectClassesForKotlinIC
| +--- :cachetool:classes (*)
| \--- :cachetool:compileKotlin (*)
\--- :cachetool:jar (*)
How may I fix this? Without the dependency line, I can't import part of my project. Here is my full build.gradle:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url "https://repo.maven.apache.org/maven2" }
}
sourceSets {
main {
java {
srcDirs = ['src/main/java', 'cachetool']
}
resources {
srcDirs = ['src/main/resources']
}
}
}
allprojects {
group = 'scape-editor'
version = '2.0.0'
}
wrapper {
gradleVersion = '7.5'
}
subprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repo.maven.apache.org/maven2" }
}
dependencies {
implementation group: 'junit', name: 'junit', version: '4.12'
testImplementation 'junit:junit:4.11'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.6.10"
}
dependencies {
implementation project(':cachetool')
}
}
And here is my settings.gradle:
rootProject.name = 'scape-editor'
include ':fs'
include ':gui'
include ':io'
include ':util'
include ':plugin'
include ':cachetool'
project(':fs').projectDir = "$rootDir/fs" as File
project(':gui').projectDir = "$rootDir/gui" as File
project(':io').projectDir = "$rootDir/io" as File
project(':util').projectDir = "$rootDir/util" as File
project(':plugin').projectDir = "$rootDir/plugin" as File
project(':cachetool').projectDir = "$rootDir/cachetool" as File
Any alternatives to what I'm doing? Thanks! =)
Picture for clarification below:
You have put this code:
dependencies {
implementation project(':cachetool')
}
inside the subprojects
closure. That's going to attempt to import the cachetool
project in every subproject, including cachetool
. See the circularity?
Items like this should only be included in the specific build.gradle
files located inside the folders for the specific subproject(s) which require such a dependency.