Gradle build is throwing the following error
What went wrong:
Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.oracle:ons:19.3.
Required by:
project :
project : > com.xyz.abc.utils:openshift-utils:2.0.30
I have added the below dependency
implementation('com.oracle:ons:19.3')
Also the below repository
mavenCentral()
maven { url 'http://repository.xyz.com:8081/artifactory/gradle-plugins'; allowInsecureProtocol true
metadataSources {
mavenPom()
artifact()
}
}
I can see this dependency under Project and External Dependencies
The project that is needing this dependency has the below line in build.gradle
compile("com.oracle:ons:19.3")
I'm using gradle wrapper and gradle version is 7.4.2
Can you please help in resolving this error?
I was also facing similar issue. This resolved for me when I used a compatible spring boot version for particular JAVA version you are using in your project.I was getting similar issue-
For example - version 3.0.0 is not compatible with JAVA 11
But when I used version 3.0.0 with JAVA 17 and rebuild the project, it was resolved
Related
when migrating to gradle 7.x getting below error
* What went wrong:
An exception occurred applying plugin request [id: 'no.nils.wsdl2java', version: '0.12']
> Failed to apply plugin 'no.nils.wsdl2java'.
> Configuration with name 'compile' not found.
Below is wsdl2java added in build.gradle
plugins {
id("no.nils.wsdl2java") version "0.12"
`java-library`
}
buildscript {
dependencies {
classpath("no.nils:wsdl2java:0.12")
}
}
how to fix this?
no.nils.wsdl2java is not compatible with Gradle 7 and is no longer maintained. See the README in the project. The compile configuration has long been deprecated and was finally removed in Gradle 7.
You can use io.mateo.cxf-codegen in place of no.nils.wsdl2java. It is a Gradle port of the Maven CXF codegen plugin.
plugins {
id "io.mateo.cxf-codegen" version "1.0.1"
}
https://github.com/ciscoo/cxf-codegen-gradle
https://ciscoo.github.io/cxf-codegen-gradle/docs/current/user-guide/
Note, I am the author of the plugin.
Gradle is running an experiment today, where they disable all HTTP communication: https://blog.gradle.org/decommissioning-http
Yesterday, I could sync my project just fine; I am not using a proxy or any other 'funky' setup.
buildscript {
ext {
...
}
repositories {
mavenCentral()
}
dependencies {
...
}
}
plugins {
id "com.palantir.docker" version "0.20.1"
}
repositories {
mavenCentral()
}
While yesterday I could download the dependencies (--refresh-dependencies), it does not work today.
./gradlew clean build --refresh-dependencies now fails with an error:
* What went wrong:
A problem occurred configuring root project 'myproject-backend'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1.
Required by:
project : > com.palantir.docker:com.palantir.docker.gradle.plugin:0.20.1
> Could not resolve gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1.
> Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/com/palantir/gradle/docker/gradle-docker/0.20.1/gradle-docker-0.20.1.pom'.
> Could not HEAD 'https://plugins.gradle.org/m2/gradle/plugin/com/palantir/gradle/docker/gradle-docker/0.20.1/gradle-docker-0.20.1.pom'.
> peer not authenticated
It's also not related to this specific plugin, all my other projects won't sync either (e.g. spring plugin cannot be synced, flyway plugin cannot be synced etc.).
I tried to upgrade my gradle version to the new 6.0, but this did not help either.
Any advice on how to solve this?
Thank you.
// EDIT: My gradle-wrapper.properties file looks like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
It may be related to your java version.
Gradle added support for TLSv3 on the 14.11.2019 (and disabled TLSv1.0) in plugins.gradle.org, and it seems that "old" Java versions have problems with it:
https://status.gradle.com/incidents/q2vq49fndxg0
For us it failed with 11.0.1, and we had to upgrade to 11.0.5
When upgrading to Gradle 4.10, I faced the following error when attempting to compile:
Execution failed for task ':buildSrc:compileKotlin'.
> Could not resolve all files for configuration ':buildSrc:kotlinCompilerPluginClasspath'.
> Could not find org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.2.60.
Searched in the following locations: file:/Users/<user-name>/.gradle/caches/4.10/embedded-kotlin-repo-1.2.60-2/repo/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.2.60/kotlin-scripting-compiler-embeddable-1.2.60.jar
Required by:
project :buildSrc
> Could not find org.jetbrains.kotlin:kotlin-sam-with-receiver:1.2.60.
Required by:
project :buildSrc
Note that I was using buildSrc as part of my Gradle compilation process.
This is due to a breaking change in Kotlin DSL 1.0:
The kotlin-dsl plugin now requires a repository to be declared
With Kotlin 1.2.60, the Kotlin Gradle Plugin driving the kotlin compiler requires extra dependencies that aren't required by Gradle Kotlin DSL scripts alone and aren't embedded into Gradle.
This can be fixed by adding a repository that contains Kotlin compiler dependencies on the project where the kotlin-dsl plugin is applied: repositories { jcenter() }
build.gradle.kts should contain
plugins {
`kotlin-dsl`
}
// Required since Gradle 4.10+.
repositories {
jcenter()
}
I am trying to set up the Sonar-Runner with my existing gradle project. I am using Sonar-Runner 2.4 Gradle 2.2.1 and our Sonar server is 4.3.1. When I run gradle sonarRunner I get the following error:
Could not resolve all dependencies for configuration ':sonarRunner'.
Cannot resolve external dependency org.codehaus.sonar.runner:sonar-runner-dist:2.4 because no repositories are defined.
I do have the artifact "org.codehaus.sonar.runner:sonar-runner-dist:2.4" in my nexus server that is set up in my build.gradle file. Does anyone have any intuition about this error? I have googled it extensively and been stuck on this for a couple of hours now.
My build.gradle for the sonar runner is very simple:
apply plugin: 'sonar-runner"
sonarRunner{
toolVersion = '2.4'
sonarProperties{
property "sonar.host.url", "$sonarHost"
}
}
It seems no repository is declared for the project you want to use with the sonar-runner plugin.
You might have configured repositories for buildscript or for other projects only (in your multiproject build?)
To resolve the sonar-runner you need to configure a repository where it could be resolved from. You might have a coorporate repository in your company or you could use public ones like mavencentral or bintray. to declare for example the jcenter repository to resolve the sonar-runner. just add the following to your build script:
repositories {
jcenter()
}
When running the "war" task for a web application project using Gradle 1.10, the following error started showing up when I included a dependency on cxf-bundle 2.6.13:
Could not resolve all dependencies for configuration ':runtime'.
Could not resolve <exclude org: module="l:ame="*" type="*.
Required by:
:gradle_dep_issue_example:unspecified > org.apache.cxf:cxf-bundle:2.6.13
java.lang.IllegalArgumentException (no error message)
Stopping and starting the gradle daemon has no effect, nor does clearing out the .gradle folder. However, running the war task and passing the --refresh-dependencies option does resolve the issue. Unfortunately, the --refresh-dependencies option must be used every time.
Here is a small build.gradle file which will reproduce the issue when the "downloadRuntimeDeps" task is run.
apply plugin: 'war'
repositories {
mavenCentral()
}
dependencies {
compile 'org.apache.cxf:cxf-bundle:2.6.13'
}
task downloadRuntimeDeps(type: Copy){
from configurations.runtime
into new File(getBuildDir(), "/runtime-deps/")
}
The issue ended up only impacting gradle version 1.10. I tested with versions 1.8 and 1.11, and neither had this problem.
There are no bug fixes included in the release notes for gradle 1.11 that reference an issue like this, so I assume this was fixed while resolving a seemingly unrelated issue.
The solution was to upgrade all my projects to use gradle 1.11