Home > Back-end >  Could not determine the dependencies of task -testone
Could not determine the dependencies of task -testone

Time:12-30

I started learning Gradle (Java Gradle) and created this very basic - build.gralde - file.

task testone(type: Test) {
    println ("Started TestSetUp")
}

In Console when ran command -> gradlew testone -- intellij is throwing error:

> Configure project :
Started TestSetUp

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':testone'.

CodePudding user response:

I think i can help you with that , By changing the type from Test to Copy , this will build perfectly , Copy is a defined type in gradle and running gradle testone -q will show your output .

I think the problem is with your defined type , by declaring the type as Test you need to add more configuration for this , because the error i got when i tried to register the task like

tasks.register testone(type: Test) {
    println ("Started TestSetUp")
}

was Could not find method testone() for arguments [{type=class org.gradle.api.tasks.testing.Test} so your issue is with the Test type , i spose your missing some extra configuration .

CodePudding user response:

In "build.gradle", after adding java plugin, the task ran successfully,
though not sure the exact underlying details about how this plugin resolved this!

plugins {
    id 'java' 
}
task testone(type: Test) {
    println ("Task of type Test Success")
}
  • Related