project.zip (3.0 KB)
When minimal example in attached zip is extracted and ‘gradle build’ is run, it is successful.
When build output is redirected using this init script at $GRADLE_USER_HOME/init.d/mysetup.gradle
allprojects {
def curDir = System.getProperty("user.dir")
def gradleUserHome = System.getenv("GRADLE_USER_HOME")
buildDir = gradleUserHome + "/userbuilds" + curDir + "/build"
println("buildDir = " + buildDir)
}
‘gradle build’ on same project throws this error
Gradle detected a problem with the following location: ‘/home/jbuild/userbuilds/lang/java/build/gradle/sample/minimal/build/classes/java/main’.
Reason: Task ‘:folderb:hello:jar’ uses this output of task ‘:foldera:compileJava’ without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
- Declare task ‘:foldera:compileJava’ as an input of ‘:folderb:hello:jar’.
- Declare an explicit dependency on ‘:foldera:compileJava’ from ‘:folderb:hello:jar’ using Task#dependsOn.
- Declare an explicit dependency on ‘:foldera:compileJava’ from ‘:folderb:hello:jar’ using Task#mustRunAfter.
Version of gradle I am using:
Gradle 8.10
Build time: 2024-08-14 11:07:45 UTC
Revision: fef2edbed8af1022cefaf44d4c0514c5f89d7b78Kotlin: 1.9.24
Groovy: 3.0.22
Ant: Apache Ant™ version 1.10.14 compiled on August 16 2023
Launcher JVM: 17.0.12 (Azul Systems, Inc. 17.0.12+7-LTS)
Daemon JVM: /usr/lib/jvm/zulu17-ca-amd64 (no JDK specified, using current Java home)
OS: Linux 5.15.0-122-generic amd64