I'm working on moving my project's build from Maven to Gradle, and using Kotlin as the DSL within Gradle. Here is my working branch. The project currently is a multi-module project, and I'm using the gradle-root subdirectory in the repo to slowly migrate each module over to using Gradle. The project is Spring Boot based.
The issue I'm hitting at the moment is with the first submodule I'm trying to move, which is the data model (comixed-model, which has no project dependencies). I can figure out how to tell Gradle how to get the dependencies it needs, such as Jackson FasterXML.
I've configured the project to use the Spring Boot plugin. But the FasterXML dependencies aren't being found. Instead, I get:
-> % gradle clean build
> Task :comixed-model:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':comixed-model:compileJava'.
> Could not resolve all files for configuration ':comixed-model:compileClasspath'.
> Could not find com.fasterxml.jackson.core:jackson-annotations:.
Required by:
project :comixed-model
> Could not find com.fasterxml.jackson.core:jackson-databind:.
Required by:
project :comixed-model
> Could not find com.fasterxml.jackson.dataformat:jackson-dataformat-xml:.
Required by:
project :comixed-model
* Try:
> 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
BUILD FAILED in 616ms
15 actionable tasks: 5 executed, 10 up-to-date
I'm not sure what I've done wrong, and Googling doesn't seem to be showing me any solutions.
Related
Im trying to build my LibGDX game with the command
./gradlew desktop:dist
but it keeps giving this error
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :core:compileJava
Note: E:\Programming\Java\LIBGdx\TextGame\core\src\com\imjustdoom\textgame\stage\PlayGame.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :desktop:dist FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':desktop:dist'.
> Cannot expand ZIP 'E:\Programming\Java\LIBGdx\TextGame\core\build\libs\core-1.0.jar' as it does not exist.
* Try:
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
BUILD FAILED in 12s
5 actionable tasks: 4 executed, 1 up-to-date
I am using intelliJ and Java 11 if that matters
I have tried running ./gradlew clean but that didnt help
Im trying to build for desktop
What plugin do you use?
I mean from which plugin does dist task come from? Or is this a custom task?
compileJava task won't produce any artifact like jar file for you, it will only generate class files.
First you have to execute gradlew build that contains assebmle task or gradlew assebmle directly so that jar will be generated in build\libs\ and only after that run gradlew desktop:dist
It's also a question how projects are structured. I see compilation is done on core project, then dist is failing on desktop one, maybe here there is another issue.
So the answer seemed to be downgrading gradlew to 6.7 using. Mustve defaulted to gradle 7 for some reason
./gradlew wrapper --gradle-version 6.7
I have attempted to rebuild the jar for https://github.com/square/okhttp library. However, this is the error I get after first cloning it and then calling "gradle assemble". Is there something incorrect about my method?
FAILURE: Build failed with an exception.
Where:
Build file '/Users/test/okhttptest/okhttp/build.gradle' line: 75
What went wrong:
Plugin [id: 'ru.vyarus.animalsniffer', version: '1.5.1'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'ru.vyarus.animalsniffer:ru.vyarus.animalsniffer.gradle.plugin:1.5.1')
Searched in the following repositories:
Gradle Central Plugin Repository
Try:
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
BUILD FAILED in 617ms
You problem is that you are using a locally installed gradle version since your call is "gradle assemble". your gradle version is propably too old so you it can't handle the plugin.
This repository has a gradle-wrapper (gradlew) checked in.
https://docs.gradle.org/current/userguide/gradle_wrapper.html
change your call into ./gradlew assemble and the wrapper will handle the download of the required gradle version and will handle all the dependencies for you.
Finished with error: Gradle task assembleDebug failed with exit code 1Greetings to everyone I am New among you flutter I want to learn, but I get such an error 5 hours in the solution could not reach it how can we solve? there is such a thing previously?
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project ‘android’.
Could not resolve all artifacts for configuration ‘:classpath’.
Could not resolve com.android.tools.build:gradle:3.5.0.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.5.0.
Could not get resource ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom’.
Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom’.
dl.google.com
Try:
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
BU�LD FAILED in 6s
This does not look like a Flutter issue (I could be wrong), but rather a Gradle one. The error entails that the Gradle plugin dependency failed, when tried to build the project.
I would suggest to look into what Gradle version you are using to build your project and see the compatible version of Gradle Plugin for that.
I am trying to build Gradle projects. Installed Gradle's latest version (6.0.1) using Homebrew. When I try gradle build in various projects (for example https://github.com/arnabmitra/trustlines-demo), it gives this error:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
> org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String, org.gradle.api.internal.file.FileResolver, org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)
* Try:
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
BUILD FAILED in 1m 25s
Similar errors happened with other projects. It's my first time using Gradle (come from Maven) and what I am trying to do is just compile the project to have .class files.
Don't use your installation of gradle. Use ./gradlew. That will automatically download and use the version of gradle that the project uses, instead of an incompatible version.
See https://docs.gradle.org/current/userguide/gradle_wrapper.html
If you are using Kotlin 1.3.10, update Kotlin to at least 1.3.20.
Issue was that Kotlin 1.3.10 uses the DefaultSourceDirectorySet constructor via reflection which has been removed in Gradle 6: https://discuss.gradle.org/t/the-defaultsourcedirectoryset-constructor-has-been-deprecated/29610
I'm trying to run a Gradle build for an existing Java project, but I get the following error that appears to be unrelated to my project.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myProject:test'.
> Could not get unknown property 'testSrcDirs' for task ':myProject:test' of type org.gradle.api.tasks.testing.Test.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
How can I fix this error?
If you land on this page searching for the testSrcDir exception, try updating the gradle clover plugin jar from 2.0.1 to latest versions.
If can't update the version you could also try the workaround suggested here
test {
ext.testSrcDirs = project.sourceSets.test.java.srcDirs
}
For me, the issue was that my project needed to be built with Gradle 2.x but I was using Gradle 3.x. Once I reverted my Gradle version, the build worked.