new jooq/gradle configuration not generating any jooq classes - gradle

I've gotten a Ratpack application working using gradle (v2.1.0) and jooq (v3.8.1) for generating class files.
Here's my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.ratpack:ratpack-gradle:1.5.4"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
classpath "mysql:mysql-connector-java:5.1.34"
classpath 'org.jooq:jooq-codegen:3.8.1'
classpath 'com.h2database:h2:1.4.186'
}
}
plugins {
id "com.github.michaelruocco.embedded-mysql-plugin" version "2.1.7"
}
apply plugin: "io.ratpack.ratpack-java"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "idea"
// db dump: mysqldump -P 3306 -h 127.0.0.1 -u embedded_user -ppassword --all-databases
def RDS_HOSTNAME = "localhost"
def RDS_PORT = 3306
def RDS_DB_NAME = "test"
def RDS_USERNAME = "embedded_user"
def RDS_PASSWORD = "password"
run {
environment "RDS_HOSTNAME", RDS_HOSTNAME
environment "RDS_PORT", RDS_PORT
environment "RDS_DB_NAME", RDS_DB_NAME
environment "RDS_USERNAME", RDS_USERNAME
environment "RDS_PASSWORD", RDS_PASSWORD
}
repositories {
jcenter()
}
ext {
ratpackPac4jVersion="2.0.0"
ratpackVersion="1.5.1"
pac4jVersion="2.1.0"
}
embeddedMysql {
url = 'jdbc:mysql://' + RDS_HOSTNAME + ':' + RDS_PORT + "/" + RDS_DB_NAME
username = RDS_USERNAME
password = RDS_PASSWORD
version = 'v5_7_latest'
}
import org.jooq.util.jaxb.*
import org.jooq.util.*
task jooqCodegen {
doLast {
String init = "$projectDir/src/main/resources/init.sql".replaceAll('\\\\', '/')
Configuration configuration = new Configuration()
.withJdbc(new Jdbc()
.withDriver("org.h2.Driver")
.withUrl("jdbc:h2:mem:todo;INIT=RUNSCRIPT FROM '$init'")
)
.withGenerator(new Generator()
.withDatabase(new Database()
.withName("org.jooq.util.h2.H2Database")
.withIncludes(".*")
.withExcludes("")
.withInputSchema("PUBLIC")
)
.withTarget(new Target()
.withDirectory("$projectDir/src/main/auto_generated")
.withPackageName("jooq")))
GenerationTool.generate(configuration)
}
}
run.dependsOn startEmbeddedMysql
dependencies {
runtime "org.slf4j:slf4j-simple:1.7.25"
compile "org.pac4j:ratpack-pac4j:${ratpackPac4jVersion}"
compile "io.ratpack:ratpack-groovy:${ratpackVersion}"
compile "io.ratpack:ratpack-test:${ratpackVersion}"
compile "org.pac4j:pac4j-core:${pac4jVersion}"
compile "org.pac4j:pac4j-oauth:${pac4jVersion}"
compile "org.pac4j:pac4j-openid:${pac4jVersion}"
compile "org.pac4j:pac4j-http:${pac4jVersion}"
compile "org.pac4j:pac4j-gae:${pac4jVersion}"
compile "org.pac4j:pac4j-oidc:${pac4jVersion}"
compile "org.pac4j:pac4j-jwt:${pac4jVersion}"
compile ratpack.dependency('hikari')
compile "ch.qos.logback:logback-classic:1.0.13"
compile group: 'io.ratpack', name: 'ratpack-thymeleaf', version: '1.4.0-rc-3'
compile "mysql:mysql-connector-java:5.1.34"
compile 'org.jooq:jooq:3.8.1'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.2.Final'
}
mainClassName = "xyz.mealsahead.Main"
I started working with the jooq API and realized I'm using an old version of jooq, so want to switch to the newer API.
The first thing I tried was just changing the two jooq references from 3.8.1 to 3.11.2. This caused problems as it seems the jooq version changed the API such that the jooq config no longer works:
> startup failed:
build file build.gradle': 72: unable to resolve class Target
# line 72, column 19.
.withTarget(new Target()
^
build file build.gradle': 66: unable to resolve class Database
# line 66, column 23.
.withDatabase(new Database()
^
build file build.gradle': 65: unable to resolve class Generator
# line 65, column 22.
.withGenerator(new Generator()
^
etc.
jooq has an example for a gradle setup, but I don't understand how it could work: https://www.jooq.org/doc/3.11/manual/code-generation/codegen-gradle/. The strange thing is buildscript block in that example isn't at the top, which from what I see in my terminal and online is not allowed:
build.gradle': 24: only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed
so I don't know how that example would work unless it's for a different version of gradle than I have (earlier or later).
Looking at the doc for the jooq-gradle plugin (https://github.com/etiennestuder/gradle-jooq-plugin), it has pretty clear steps for setting up the gradle script, so I modified the build.gradle file to look like the following:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.ratpack:ratpack-gradle:1.5.4"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
classpath "mysql:mysql-connector-java:5.1.34"
classpath 'com.h2database:h2:1.4.186'
classpath 'nu.studer:gradle-jooq-plugin:3.0.1'
}
}
plugins {
id "com.github.michaelruocco.embedded-mysql-plugin" version "2.1.7"
}
apply plugin: 'nu.studer.jooq'
apply plugin: "io.ratpack.ratpack-java"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "idea"
// db dump: mysqldump -P 3306 -h 127.0.0.1 -u embedded_user -ppassword --all-databases
def RDS_HOSTNAME = "localhost"
def RDS_PORT = 3306
def RDS_DB_NAME = "test"
def RDS_USERNAME = "embedded_user"
def RDS_PASSWORD = "password"
run {
environment "RDS_HOSTNAME", RDS_HOSTNAME
environment "RDS_PORT", RDS_PORT
environment "RDS_DB_NAME", RDS_DB_NAME
environment "RDS_USERNAME", RDS_USERNAME
environment "RDS_PASSWORD", RDS_PASSWORD
}
repositories {
jcenter()
}
ext {
ratpackPac4jVersion="2.0.0"
ratpackVersion="1.5.1"
pac4jVersion="2.1.0"
}
embeddedMysql {
url = 'jdbc:mysql://' + RDS_HOSTNAME + ':' + RDS_PORT + "/" + RDS_DB_NAME
username = RDS_USERNAME
password = RDS_PASSWORD
version = 'v5_7_latest'
}
dependencies {
jooqRuntime 'com.h2database:h2:1.4.193'
}
jooq {
String init = "$projectDir/src/main/resources/init.sql".replaceAll('\\\\', '/')
version = '3.11.2'
edition = 'OSS'
sample(sourceSets.main) {
jdbc {
driver = "org.h2.Driver" //'org.postgresql.Driver'
url = "jdbc:h2:mem:todo;INIT=RUNSCRIPT FROM '$init'" //'jdbc:postgresql://localhost:5432/sample'
user = 'sa'
password = ''
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
database {
name = 'org.jooq.meta.h2.H2Database'
includes = '.*'
excludes = ''
inputSchema = 'public'
}
generate {
relations = true
deprecated = false
records = true
immutablePojos = true
fluentSetters = true
}
target {
directory = "$projectDir/src/main/auto_generated"
packageName = 'jooq'
}
}
}
}
run.dependsOn startEmbeddedMysql
dependencies {
runtime "org.slf4j:slf4j-simple:1.7.25"
compile "org.pac4j:ratpack-pac4j:${ratpackPac4jVersion}"
compile "io.ratpack:ratpack-groovy:${ratpackVersion}"
compile "io.ratpack:ratpack-test:${ratpackVersion}"
compile "org.pac4j:pac4j-core:${pac4jVersion}"
compile "org.pac4j:pac4j-oauth:${pac4jVersion}"
compile "org.pac4j:pac4j-openid:${pac4jVersion}"
compile "org.pac4j:pac4j-http:${pac4jVersion}"
compile "org.pac4j:pac4j-gae:${pac4jVersion}"
compile "org.pac4j:pac4j-oidc:${pac4jVersion}"
compile "org.pac4j:pac4j-jwt:${pac4jVersion}"
compile ratpack.dependency('hikari')
compile "ch.qos.logback:logback-classic:1.0.13"
compile group: 'io.ratpack', name: 'ratpack-thymeleaf', version: '1.4.0-rc-3'
compile "mysql:mysql-connector-java:5.1.34"
compile 'org.jooq:jooq'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.2.Final'
}
mainClassName = "xyz.mealsahead.Main"
Running "gradle run" works fine, so I assume it's downloading that new version of jooq, but now I don't see any code generated. I see the following message:
$ gradle generateSampleJooqSchemaSource
:generateSampleJooqSchemaSource UP-TO-DATE
Can someone tell me if I:
am using the appropriate gradle-jooq plugin for this?
have misconfigured the new generator syntax from the previous version?

Regarding your manual setup of the jOOQ code generator
Indeed, due to the upcoming modularisation of jOOQ 3.12, some split packages had to be renamed, namely the org.jooq.util package. In your manual setup, you need to change your imports from:
import org.jooq.util.jaxb.*
import org.jooq.util.*
To
import org.jooq.codegen.*
import org.jooq.meta.jaxb.*
import org.jooq.meta.*
Regarding your usage of the third party Gradle plugin
Do note that schema names are case sensitive, so probably it would help replacing this:
inputSchema = 'public'
By this
inputSchema = 'PUBLIC'
You already had it correct earlier: .withInputSchema("PUBLIC")

Related

'Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.' error

Since I wanted to examine this source code, I imported it into Android Studio. I got a few other errors before and fixed them. This is annoying, now I have a new error.
I am getting this error:
Build file 'C:\Users\hange\Desktop\libgdx-demo-superjumper-master\desktop\build.gradle' line: 18
A problem occurred evaluating project ':desktop'.
> Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
My "desktop\build.gradle" file looks like this. I specified line 18 there.
apply plugin: "java"
sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "com.badlogicgames.superjumper.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets");
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir) // THIS IS 18th LINE.
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
dist.dependsOn classes
EDIT: My "build.gradle" file looks like this. But I noticed that it can't resolve the json library. Probably the error is here because we are pulling the gradle version from a json file on the internet.
import groovy.json.JsonSlurper // Cannot resolve symbol 'json'
buildscript {
ant.get(src: 'https://libgdx.com/service/versions.json', dest: 'versions.json')
def versionFile = file('versions.json')
def json
if (versionFile.exists()) {
json = new JsonSlurper().parseText(versionFile.text)
} else throw new GradleException("Unable to retrieve latest versions, please check your internet connection")
ext {
gdxVersion = json.libgdxRelease
roboVMVersion = json.robovmVersion
roboVMGradleVersion = json.robovmPluginVersion
androidToolsVersion = json.androidBuildtoolsVersion
androidSDKVersion = json.androidSDKVersion
androidGradleToolsVersion = json.androidGradleToolVersion
gwtVersion = json.gwtVersion
gwtGradleVersion = json.gwtPluginVersion
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath "org.wisepersist:gwt-gradle-plugin:$gwtGradleVersion"
classpath "com.android.tools.build:gradle:$androidGradleToolsVersion"
classpath "com.mobidevelop.robovm:robovm-gradle-plugin:$roboVMGradleVersion"
}
}
I'm posting the solution in case anyone else has the same problem:
androidToolsVersion, androidSDKVersion, androidGradleToolsVersion, gwtGradleVersion
These 4 variables are pulled from a json file on the internet, but the value pulled from the json file may not always work correctly. Make the variables compatible.
For example this code is using classesDir.The classesDir property was removed in Gradle 5.x.
If you pull to Gradle 4.8.1, you will get the error "Minimum supported Gradle version is 6.5. Current version is 4.8.1.". To fix this error you have to assign 3.2.x value compatible with 4.8.1 gradle version to the androidGradleToolsVersion variable.
androidGradleToolsVersion = "3.2.1"

I got an error using this build.grafle file and don't know how to fix it

Here's the Error:
FAILURE: Build failed with an exception.
Where: Build file '/home/wieland/GitGradlePackaging/build.gradle' line: 22
What went wrong: A problem occurred evaluating root project 'GitGradlePackaging'.
Could not get unknown property 'org' for object of type org.gradle.api.internal.initialization.DefaultScriptHandler.
And Here's my build.gradle File:
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.6/userguide/tutorial_java_projects.html
*/
//From example: http://mrhaki.blogspot.co.at/2015/04/gradle-goodness-use-git-commit-id-in.html
buildscript {
repositories {
jcenter()
}
dependencies {
//Add dependencies for build script, so we can access Git from our build script
classpath 'org.ajoberstar:grgit:1.1.0'
}
def git = org.ajoberstar.grgit.Grgit.open(file('.'))
//To save Githash
def githash = git.head().abbreviatedId
}
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
// Apply the groovy plugin to also add support for Groovy (needed for Spock)
id 'groovy'
id 'distribution'
}
// Set version
project.version = mainProjectVersion + " - " + githash
project.ext.set("wholeVersion", "$project.version - $githash")
project.ext.set("buildtimestamp", "2000-01-01 00:00")
def versionfilename = "versioninfo.txt"
def GROUP_DEBUG = 'Debug'
// Task to print project infos
task debugInitialSettings {
group = GROUP_DEBUG
doLast {
println 'Version: ' + project.wholeVersion
println 'Timestamp: ' + project.buildtimestamp
println 'Filename: ' + project.name
}
}
// To add the githash to zip
task renameZip {
doLast {
new File ("$buildDir/distributions/$project.name-${project.version}.zip")
.renameTo ("$buildDir/distributions/$project.name-${project.wholeVersion}.zip")
}
}
distZip.finalizedBy renameZip
// To add the githash to tar
task renameTar{
doLast {
new File ("$buildDir/distributions/$project.name-${project.version}.tar")
.renameTo ("$buildDir/distributions/$project.name-${project.wholeVersion}.tar")
}
}
distTar.finalizedBy renameTar
// Define the main class for the application
mainClassName = 'App'
dependencies {
// This dependency is found on compile classpath of this component and consumers.
compile 'com.google.guava:guava:23.0'
// Use the latest Groovy version for Spock testing
testCompile 'org.codehaus.groovy:groovy-all:2.4.13'
// Use the awesome Spock testing and specification framework even with Java
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'junit:junit:4.12'
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
//To generate Testreports as HTML
test {
reports {
junitXml.enabled = false
html.enabled = true
}
}
distributions {
main {
contents {
from { 'build/docs' }
into ('reports') {
from 'build/reports'
}
}
}
}
//To make sure that test and javadoc ran before zip and tar
distTar.dependsOn test
distZip.dependsOn test
distTar.dependsOn javadoc
distZip.dependsOn javadoc
Please keep in mind I have not much knowledge about gradle as I'm just starting to learn it!
Thanks in advance :)
You have to move the githash definition outside the buildscript block
buildscript {
repositories {
jcenter()
}
dependencies {
//Add dependencies for build script, so we can access Git from our build script
classpath 'org.ajoberstar:grgit:1.1.0'
}
}
def git = org.ajoberstar.grgit.Grgit.open(file('.'))
//To save Githash
def githash = git.head().abbreviatedId
The reason is that when the buildscript block is evaluated line by line, its dependencies are not yet loaded. When the rest of the script is evaluated, the dependencies of the buildscript block have already been loaded. This is actually the reason for the buildscript block existence: to be run before the rest of the build and prepare the setup.

Trying to add Applied Energistics api through build.gradle

I am starting on a minecraft mod, but I cannot get the build.gradle right.
I wanted to create a mod on top of applied energistics but I cannot get it to build when I add this mod as a gradle dependency. I looked all the dependencies up on an other repository, but when I build it gives errors like below, and some other errors on the general minecraft code base
Error:(3, 26) java: package net.minecraft.init does not exist
This is the code I have right now:
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
version = mod_version + "-" + mod_channel
group = mod_group
archivesBaseName = mod_basename
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = minecraft_version + "-" + forge_version
replaceIn "package-info.java"
replace "#version#", project.version
replace "#modversion#", mod_version
replace "#modchannel#", mod_channel
// used when launching minecraft in dev env
mappings = mcp_mappings
}
repositories {
maven {
name 'Mobius Repo'
url "http://mobiusstrip.eu/maven"
}
maven {
name = "JEI repo"
url "http://dvs1.progwml6.com/files/maven"
}
}
dependencies {
// installable runtime dependencies
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
deobfCompile "appeng:appliedenergistics2:${ae_verion}"
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
The version that I am trying to add is:
ae_verion=rv5-stable-8
You need to add 'api' at the end of the compile argument (used to be 'dev'). Also, iirc adding transitive=false solves dependency issues.
dependencies {
compile ("appeng:appliedenergistics2:${ae_version}:api") {
transitive = false
}
}

Gatling running multiple simulations with Gradle plugin

The Gradle plugin (https://github.com/commercehub-oss/gatling-gradle-plugin, v2.1) claims The ability to configure multiple simulations per gradle project
Given the following gradle file:
apply plugin: 'scala'
group '****'
version '1.0-SNAPSHOT'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.commercehub:gatling-gradle-plugin:2.1'
}
}
repositories {
jcenter()
}
ext {
SCALA_VERSION = "2.11.7"
GATLING_VERSION = "2.2.3"
}
dependencies {
compile "org.scala-lang:scala-library:${SCALA_VERSION}"
testCompile 'com.typesafe:config:1.3.1'
testCompile "io.gatling.highcharts:gatling-charts-highcharts:${GATLING_VERSION}"
testCompile "io.gatling:gatling-test-framework:${GATLING_VERSION}"
}
apply plugin: 'gatling'
import com.commercehub.gradle.plugin.GatlingTask
task loadTest(type: GatlingTask, dependsOn: ['testClasses']) {
gatlingSimulation = 'HealthSimulation,PlaceAttributesSimulation'
jvmOptions {
jvmArgs = [
"-Dlogback.configurationFile=${logbackGatlingConfig()}",
"-Denv=${System.getProperty('env', 'stg')}",
]
minHeapSize = "1024m"
maxHeapSize = "1024m"
}
}
def logbackGatlingConfig() {
return sourceSets.test.resources.find { it.name == 'logback-gatling.xml' }
}
in particular the line gatlingSimulation = 'HealthSimulation,PlaceAttributesSimulation', I would expect both simulation to be run. Why? Because looking at the Gradle plugin, gatlingSimulation is then passed to Gatling -s flag.
Long story short, Gatling -s does not support multiple simulations anymore (see https://github.com/gatling/gatling/issues/363 for details), so I think I am missing a bit in the gradle plugin I am using to enable multiple simulations.
Both simulations run fine when run individually, but if I try to run them together, Gatling stucks asking which one to execute. Any suggestion how to achieve running multiple simulations (sequentially) in the same gradle project?
EDIT: my currently ugly workaround (suggestions welcome to make it less ugly, but still workaround imo) is to modify the Gradle build file with:
task loadTests;
fileTree(dir: 'src/test').include("**/*Simulation.scala").each {target ->
ext {
filename = target.toString()
filename = filename.substring(filename.indexOf("scala") + "scala".length() + 1)
filename = filename.substring(0, filename.indexOf(".")).replaceAll("/", ".")
}
task("loadTest${filename}", type: GatlingTask, dependsOn: 'testClasses', description : "Load test ${filename}s") {
gatlingSimulation = filename
jvmOptions {
jvmArgs = [
"-Dlogback.configurationFile=${logbackGatlingConfig()}",
"-Denv=${System.getProperty('env', 'stg')}",
]
minHeapSize = "1024m"
maxHeapSize = "1024m"
}
}
loadTests.dependsOn("loadTest${filename}")
}
def logbackGatlingConfig() {
return sourceSets.test.resources.find { it.name == 'logback-gatling.xml' }
}
Basically, I create a GatlingTask for each *Simulation.scala file (naming convention) and then create a bulk loadTests task that depends on all.

driver error for geb-gradle-saucelabs integration

I am trying to run below build.gradle with saucelabs integration . Below is GebConfig.groovy
import org.openqa.selenium.chrome.ChromeDriver
import geb.driver.SauceLabsDriverFactory
import geb.buildadapter.BuildAdapterFactory
//driver = { new ChromeDriver() }
def sauceBrowser = System.getProperty("geb.saucelabs.browser")
if (sauceBrowser) {
driver = {
def username = System.getenv("username")
assert username
def accessKey = System.getenv("accesskey")
assert accessKey
new SauceLabsDriverFactory().create(sauceBrowser, username, accessKey)
}
}
I am setting geb.saucelabs.browser prop in build.gradle according to this. Full build.gradle looks like
apply plugin: "geb-saucelabs"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.gebish:geb-gradle:0.13.1'
}
}
apply plugin: 'java'
apply plugin: 'groovy'
repositories {
mavenCentral()
maven { url "http://repository-saucelabs.forge.cloudbees.com/release" }
}
dependencies {
def seleniumVersion = '2.45.0'
def phantomJsVersion = '1.1.0'
def groovyVersion = '2.4.3'
//groovy
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
// selenium drivers
testCompile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
//testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testRuntime "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testCompile("com.github.detro.ghostdriver:phantomjsdriver:$phantomJsVersion") {
transitive = false
}
// geb
testCompile "org.gebish:geb-spock:0.10.0"
// spock
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
//junit
testCompile "org.gebish:geb-junit4:0.10.0"
testCompile "junit:junit-dep:4.8.2"
sauceConnect "com.saucelabs:sauce-connect:3.0.28"
}
sauceLabs {
browsers {
chrome_mac
}
task {
testClassesDir = test.testClassesDir
testSrcDirs = test.testSrcDirs
classpath = test.classpath
}
account {
username = System.getenv("username")
accessKey = System.getenv("accessKey")
}
}
test {
System.setProperty("geb.saucelabs.browser ","browserName=firefox platform=LINUX version=19")
systemProperties "geb.build.reportsDir": "$reportsDir/geb"
}
but I recieve error and I think driver is not configuring correctly, whats missing in confirguration?
The path to the driver executable must be set by the webdriver.ie.driver system property;
What's the command you use to run your test? You shouldn't be fiddling with geb.saucelabs.browser system property for the test task but use the chromeMacTest task as per documentation you link to in your question.
This has been resolved by setting the env variables on mac in .profile and .bash_profile in this way
export SAUCE_USERNAME=username
export SAUCE_ACCESS_KEY-youraccesskey
Before it was adding quotes to both

Resources