Task 'gradle' not found in root project


(saravanakumarm.1986) #1

I build automation script ion gradle my build.gradle file

apply plugin: ‘java’ apply plugin: ‘eclipse’ apply plugin: ‘maven’

repositories {

mavenCentral()

}

sourceSets {

unitTest {

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

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

}

}

task wrapper(type: Wrapper) {

description = ‘Install Gradle wrapper’

gradleVersion = ‘1.8’

} dependencies {

compile ‘org.apache.poi:poi:3.5-beta5’

compile ‘org.testng:testng:6.8.5’

compile ‘org.seleniumhq.selenium:selenium-server:2.39.0’

compile ‘com.googlecode.json-simple:json-simple:1.1’

compile ‘net.sf.json-lib:json-lib:2.3:jdk13’

compile ‘org.mockito:mockito-all:1.9.0’

compile ‘log4j:log4j:1.2.17’ }

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

I dont understand what is the root project?. Anyone can you give me a soltuion for this?