我构建自动化脚本离子gradle我的build.gradle文件
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'
}
}
}
执行build.gradle时抛出错误
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)
我的文件夹结构
src / main / java - 默认类文件 src / main / resource-default文件 src / test / java-所有类文件都可用
任何人都可以为此解释一下吗?