我正在从事Selenium Gradle项目,在该项目中,我不小心更改了一些会导致构建结构发生更改的配置。更改之前,我的项目结构是
project-dir
现在是
project-dir
当我运行命令“ gradlew build”时,它应该运行所有功能部件文件,但更改后不起作用。你能帮我什么地方出错了。我是这一切的新手。
我正在使用 摇动4.12 硒2.53.0 黄瓜准1.2.5 黄瓜java 1.2.5 黄瓜芯1.2.5
Gradle.build文件:
-
import java.text.DateFormat
import java.text.SimpleDateFormat
version '1.0-SNAPSHOT'
task gitBuildId {
description = "Determine the build id from git"
def buildIdOut = new ByteArrayOutputStream()
def errorsOut = new ByteArrayOutputStream()
def extraInfo = ""
try {
exec {
// TODO: use a java git library?
standardOutput = buildIdOut
errorOutput = errorsOut
commandLine 'git', 'log', '-1', '--pretty=format:%ct|%h', 'HEAD'
}
} catch (Exception e) {
buildIdOut.write('0'.getBytes())
if (errorsOut.toString().contains("Not a git repository")) {
extraInfo = "(Not a git repository and/or no commits found)\n" +
"Type: git init; git add *; git commit *;"
}
}
//OR? def buildIdOut = (long) ((new Date()).getTime() / 1000)
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss")
df.setTimeZone(TimeZone.getTimeZone("GMT"))
//split into hash and timestamp
String[] parts = buildIdOut.toString().split("\\|")
def inTimeStamp = Long.parseLong(parts[0])
def date = new Date((inTimeStamp as long) * 1000)
def dateString = df.format(date)
def buildId = "${dateString}.${parts[1]}"
println "buildId = ${buildId} ${extraInfo}"
ext.output = {
return buildId
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
//def buildId = rootProject.tasks.gitBuildId.output()
def rpmVersion = '0.0.0'
//apply plugin: 'java'
//apply plugin: 'gradle-one-jar'
apply plugin: 'application'
//apply plugin: 'idea'
sourceCompatibility = 1.8
// UTF-8 should be standard by now. So use it!
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
mainClassName = 'cucumber.api.cli.Main'
// Add Gradle OneJar Plugin, see https://github.com/rholder/gradle-one-jar
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.0'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-jvm-deps', version: '1.0.3'
testCompile group: 'info.cukes', name: 'gherkin', version: '2.7.3'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.8'
testCompile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
testCompile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.6'
testCompile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.0.2'
testCompile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6'
testCompile group: 'org.json', name: 'json', version: '20140107'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
compile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-jvm-deps', version: '1.0.3'
}
// Configure the oneJar task
task oneJar() {
doLast {
mainClass = mainClassName
}
}
//def buildId = rootProject.tasks.gitBuildId.output()
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'application'
mainClassName = 'cucumber.api.cli.Main'
// IDE support
apply from: rootProject.file('gradle/ide.gradle')
//cucumber support
//apply from: rootProject.file('gradle/cucumber.gradle')
if (version == 'unspecified') {
version = '0.0.0'
def envVersion = System.env['VERSION']
if (envVersion) {
version = envVersion
}
}
distZip.doFirst {
copy {
from('bin') {
include '**/*'
}
into file("src/dist/bin")
fileMode = 0755
}
}
}
task deleteTestResults() {
delete "build/test-results/test/"
delete "cucumber-html-reports"
}
/*task cucumberTest() {
def arglist = ["--monochrome", "--plugin", "pretty", "--glue", "com.automation.server",
"src/test/resources/features/"]
return javaexec {
main = "cucumber.api.cli.Main"
classpath = sourceSets.main.runtimeClasspath
args = arglist
}
}*/
test {
//we want display the following test events
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
//showStandardStreams = true
}
}
task testBoth {
println 'This is executed last during the execution phase.'
}
task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}
artifacts {
oneJar
}