So I've been attempting to get these tools running together, but I can't seem to get things setup properly. Each time I am presented with the following error:
The project was not built since its build path is incomplete. Cannot find the class file for org.spockframework.mock.MockController. Fix the build path then try building this project.
I've created this gist. When I run gradle chrome test I get the following output:
gradle chrome test
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestGroovy'.
> org/spockframework/mock/MockController
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I'm using gradle 1.3, geb 0.7.2 and spock 0.7-groovy-2.0. I've also tried updating geb to utilize 0.9.0-RC-1. The gist above should have everything needed to see this same error.
This is what you get when you run Spock 0.7 with Geb versions lower than 0.9.0-RC-1 (which aren't compatible with Spock 0.7). Double check your setup and perform a clean build.
I was running into the same problem. It turns out you need to use the groovy 1.8 version because the Geb/Spock integration jars haven't been upgraded to groovy 2.0 yet. The following setup worked for me:
dependencies {
def seleniumVersion = "2.42.2"
def phantomJsVersion = '1.1.0'
def cargoVersion = '1.4.9'
// selenium drivers
compile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
compile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
compile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
compile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
compile("com.github.detro.ghostdriver:phantomjsdriver:$phantomJsVersion") {
transitive = false
}
// geb
compile 'org.codehaus.geb:geb-core:0.7.2'
compile 'org.codehaus.geb:geb-spock:0.7.2'
// spock
compile 'org.spockframework:spock-core:0.6-groovy-1.8'
compile 'junit:junit:4.8.2'
compile 'org.slf4j:slf4j-log4j12:1.7.6#jar'
compile 'org.slf4j:slf4j-api:1.7.6#jar'
}
I posted my full script that includes cargo integration on my blog: http://www.openscope.net/2015/02/21/how-to-configure-gebspock-with-gradle/
Related
Configure project :app
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.github.bumptech.glide:compiler:4.12.0'.
FAILURE: Build failed with an exception.
What went wrong:
Task 'package' is ambiguous in root project 'DemoApp'. Candidates are: 'packageDebug', 'packageDebugAndroidTest', 'packageDebugBundle', 'packageDebugUniversalApk', 'packageRelease', 'packageReleaseBundle', 'packageReleaseUniversalApk', 'packageStaging', 'packageStagingBundle', 'packageStagingUniversalApk'.
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. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
I had the same error and struggled for a long time to fix it, you have to make some changes in gradle.
First add this to the classpath:
buildscript {
repositories {
...
...
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'
//add the newest ksp maven version here
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.7.20-Beta-1.0.6"
...
}
}
Be sure that the ksp version match with your kotlin plugin version, you can also check the maven website here: maven
Then in the build.gradle add the ksp plugin, add the new ksp compileOption and change the kap annotatons to ksp:
plugins {
...
...
id 'com.google.devtools.ksp'
}
android{
...
ksp {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
...
}
dependencies {
...
//room
def roomVersion = "2.4.3"
implementation("androidx.room:room-runtime:$roomVersion")
//replace kap with ksp and should work correctly
ksp "androidx.room:room-compiler:$roomVersion"
implementation("androidx.room:room-ktx:$roomVersion")
...
}
I am trying to compile a project using the new Groovy 3.0.4 compiler and Gradle 5.6.4:
dependencies {
implementation "org.codehaus.groovy:groovy-all:3.0.4"
...
But the compilation (./gradlew --stacktrace build) fails with the error:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileGroovy'.
...
Caused by: java.lang.NoClassDefFoundError: org/codehaus/groovy/transform/stc/AbstractExtensionMethodCache
...
The class AbstractExtensionMethodCache is part of the Groovy compiler, why the compiler cannot find it? The project compiles fine with Groovy 2.5.12.
Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
In case of Cordova OR Ionic App
I have the similar problem with my ionic 1 cordova build after Integrating the Firebase Cloud Messaging ( FCM )
Error Message
What went wrong:
Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.605 secs
Error: /Users/beo-administrator/Documents/projects/Apps/Ionic/psc/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
Solution
I fixed this issue by the following steps
So one fix will be: inside platforms/android open project.properties (Its a file ) , you will have something like this
cordova.system.library.1=com.google.android.gms:play-services-ads:+
cordova.system.library.2=com.google.firebase:firebase-core:+
cordova.system.library.3=com.google.firebase:firebase-messaging:+
Replace the
+
Sign with your target version number - like the following
cordova.system.library.1=com.google.android.gms:play-services-ads:9.0.0
cordova.system.library.2=com.google.firebase:firebase-core:9.0.0
cordova.system.library.3=com.google.firebase:firebase-messaging:9.0.0
Save the file
Then take build using
ionic cordova run android
Go to platforms > android > android build.gradle and add below three lines in dependencies area
compile "com.google.firebase:firebase-core:9.0.0"
compile "com.google.firebase:firebase-messaging:9.0.0"
compile "com.google.android.gms:play-services-gcm:9.0.0"
Now your update dependencies looks like as-
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: 'CordovaLib', configuration: 'debug')
releaseCompile project(path: 'CordovaLib', configuration: 'release')
compile 'com.android.support:support-v4:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.14.+'
// compile 'com.google.firebase:firebase-core:+'
// compile 'com.google.firebase:firebase-messaging:+'
// SUB-PROJECT DEPENDENCIES END
compile files('libs/twitter4j-core-4.0.2.jar')
compile 'com.google.code.gson:gson:2.8.0'
compile "com.google.firebase:firebase-core:9.0.0"
compile "com.google.firebase:firebase-messaging:9.0.0"
compile "com.google.android.gms:play-services-gcm:9.0.0"
}
Go to platforms > android > cordova-plugin-fcm. Find file that look like something-FCMPlugin.gradle.
Then change to:
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0' // change this line
}
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
source:
https://stackoverflow.com/a/44039853/8037833
Had the same problem and the other answers didn't work for me.(as on build the build.gradle get's edited and the version nr return to the previous nr.)
I've fixed it by editing the project.properties file in platforms/android/
target=android-25
android.library.reference.1=CordovaLib
cordova.gradle.include.1=com-sarriaroman-photoviewer/starter-photoviewer.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v13:25.1.0
cordova.system.library.3=me.leolin:ShortcutBadger:1.1.17#aar
cordova.system.library.4=com.google.firebase:firebase-messaging:11.0.1
cordova.gradle.include.2=phonegap-plugin-push/starter-push.gradle
cordova.system.library.5=com.google.android.gms:play-services-base:11.0.1
cordova.system.library.6=com.google.android.gms:play-services-ads:11.0.1
Make sure that there is the same version of com.google.android.gms
I am using Groovy/Gradle with Cucumber framework. following are the versions
Groovy Version: 2.4.4
------------------------------------------------------------
Gradle 2.5
------------------------------------------------------------
Build time: 2015-07-08 07:38:37 UTC
Build number: none
Revision: 093765bccd3ee722ed5310583e5ed140688a8c2b
Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_17 (Oracle Corporation 23.7-b01)
OS: Windows 8 6.2 amd64
I am getting this error when I try to run following
$ gradle clean idea
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Documents and Settings\Sudheerah\Documents\Sudheera\KBase\APDM\APIAutomation\build.gradle' line: 76
* What went wrong:
A problem occurred evaluating root project 'APIAutomation'.
> Could not find method groovy() for arguments [org.codehaus.groovy:groovy-all:2.4.4] on root project 'APIAutomation'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 35.237 secs
Below is the build.gradle file error line.
Stacktrace
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method groovy() for arguments [org.codehaus.groovy:groovy-all:2.4.4] on root project 'APIAutomation'.
at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
Assuming you've applied the groovy plugin, you need to change your groovy dependency to a compile dependency.
The groovy dependency is the old way of setting up the groovy plugin
I have a build.gradle file (from the custom plugin example in the manual) that reads:
apply plugin: 'groovy'
dependencies {
compile gradleApi()
compile localGroovy()
}
But when I run I get:
$ gradle build
:compileJava UP-TO-DATE
:compileGroovy
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> You must assign a Groovy library to the 'groovy' configuration.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Any idea what I am missing?
Ensure you have both:
apply plugin: 'groovy'
and use the groovy keyword in the dependencies section (rather than using the compile keyword):
dependencies {
groovy 'org.codehaus.groovy:groovy-all:2.0.8
}
All credit to this blog.
Short answer, upgrade to a newer version.
The above problem (and a few more) where happening on v1.0.8, upgrading to v1.6 and its all works properly