Task 'gradle' not found in root project

I build automation script ion gradle my build.gradle file

apply plugin: ‘java’ apply plugin: ‘eclipse’ apply plugin: ‘maven’ sourceCompatibility = 1.7 version = ‘1.0’ jar { manifest {

attributes ‘Implementation-Title’: ‘RESTAPIClientAutomation’, ‘Implementation-Version’:

Version } } repositories { mavenLocal() mavenCentral() } task wrapper(type: Wrapper) {

description = ‘Install Gradle wrapper’

gradleVersion = ‘1.10’ } dependencies {

compile ‘org.apache.poi:poi:3.5-beta5’ testCompile ‘org.testng:testng:6.8.5’ compile ‘org.seleniumhq.selenium:selenium-server:2.39.0’

compile ‘log4j:log4j:1.2.17’ compile ‘com.googlecode.json-simple:json-simple:1.1’ compile ‘net.sf.json-lib:json-lib:2.4:jdk15’

}

sourceSets { unitTest {

java.srcDir file(‘src/test/java’)

resources.srcDir file(‘src/test/resources’) }

} test { useTestNG() { useDefaultListeners = true ignoreFailures = true options.suites(“src/test/resources/testng.xml”) options {

listeners << ‘org.uncommons.reportng.HTMLReporter’

listeners << ‘org.uncommons.reportng.JUnitXMLReporter’

}

}

}

uploadArchives {

repositories {

flatDir {

dirs ‘repos’

}

}

}

While executing build.gradle its throwing the error

FAILURE: Build failed with an exception.\

  • What went wrong:

Task ‘gradle’ not found in root project ‘RESTAPIClient-Gradle’.

  • Try:

Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack

trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.126 secs

[sts] Build failed

org.gradle.tooling.BuildException: Could not execute build using Gradle distribution

http://services.gradle.org/distributions/gradle-1.10-bin.zip’.at

org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:53) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57) at

org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

My folder structure

src/main/java - default class file src/main/resource-default files src/test/java-All the Classfile is available

Anyone can you give me a soltuion for this?

what command and parameter did you call in your commandline? seems like you typed something like “gradle gradle” where the 2nd gradle is interpreted as a task that is not available in your project

1 Like