When gradle tries to download org.springframework.boot', version: '2.1.9.RELEASE' through Gradle Central Plugin Repository It can't do it
FAILURE: Build failed with an exception.
* Where:
Build file '/usr/src/app/build.gradle' line: 2
* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.1.9.RELEASE'] 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 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.9.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository
But when using wget it can pull it
$ wget https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.1.9.RELEASE/org.springframework.boot.gradle.plugin-2.1.9.RELEASE.pom
--2020-07-17 13:38:07-- https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.1.9.RELEASE/org.springframework.boot.gradle.plugin-2.1.9.RELEASE.pom
Resolving plugins.gradle.org (plugins.gradle.org)... 104.18.190.9, 104.18.191.9, 2606:4700::6812:bf09, ...
Connecting to plugins.gradle.org (plugins.gradle.org)|104.18.190.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Also I tried to use our nexus proxy but it didn't help
pluginManagement {
repositories {
maven { url 'https://${NEXUS_LINK}/repository/GradlePluginPortal/' }
mavenLocal()
}
}
I have had a ton of issues with Gradle regarding this.
Two pointers:
run ./gradlew --debug through command line, check for any errors about not being able to connect - gradle does not respect proxy settings elsewhere, you have to supply them yourself in gradle.properties (like this)
try having org.gradle.jvmargs=-Djavax.net.debug=ssl in gradle.properties to see if there are SSL issues - I had "SunCertPathBuilderException: unable to find valid certification path to requested target", which was not reported when using any command line debug flags. Fixing that seems to be a pain though.
Related
I was trying to setup the spring boot open source project in order to contribute it. I was going through the steps in here. I am on the main branch. When I try to run
./gradlew build
I am getting this error
* Where:
Settings file '<my local path>/spring-boot/settings.gradle' line: 26
* What went wrong:
Plugin [id: 'io.spring.ge.conventions', version: '0.0.12'] 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 'io.spring.ge.conventions:io.spring.ge.conventions.gradle.plugin:0.0.12')
Searched in the following repositories:
MavenRepo
Gradle Central Plugin Repository
maven(https://repo.spring.io/release)
maven2(https://repo.spring.io/snapshot)
settings.gradle contains this at line 26
id "io.spring.ge.conventions" version "0.0.12"
From what I understand in the above log, gradle is trying to search for io.spring.ge.conventions but its not able to find it in those repositories. I haven't used gradle before so I am not sure what the issue is exactly and how to fix it.
These are my system details:
System: Mac(Intel)
java version "17.0.5" 2022-10-18 LTS
Editor: Intellij
I don't have gradle installed separately. I am using the gradle wrapper provided by the project.
Additionally I just commented out that line in settings.gradle and ran the build. It succeeded.
Can anyone help me out on this?
I've been trying to work on this for hours now, but I'm not sure what the problem is specifically. If it helps, I'm doing this in Visual Studio.
Plugin [id: 'fabric-loom', version: '1.0-SNAPSHOT/'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/7.5.1/userguide/standard_plugins.html for available core plugins)
- Plugin Repositories (could not resolve plugin artifact 'fabric-loom:fabric-loom.gradle.plugin:1.0-SNAPSHOT/')
Searched in the following repositories:
Fabric(https://maven.fabricmc.net/)
MavenRepo
Gradle Central Plugin Repository
I'm trying append a private dependency into my project (react-native-android) via Maven. Unfortunately I'm get following error message when I try to build ./gradlew assembleDebug my project.
Error message returned as below:
> FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve com.facebook.react:react-native:0.19.+.
Required by:
project :app > project :react-native-i18n
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'. Received status code 403 from server: Forbidden
Code example
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://xxxPRIVATE_REPOxxx/android" }
}
dependencies {
implementation project(':react-native-i18n')
implementation 'com.android.support:support-v4:+'
implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+'
}
I have read numerous post and research on maven and gradle's topic. Here's my finding towards my issues:
Meaning that my sequence of declaring maven by right will get the "correct/suitable" module from the first declared maven instead of the following (maven xxxPRIVATE_REPOxxx)
The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from the same repository. You can learn more about the inner workings of dependency downloads.
Returning of 403 Forbidden does not necessary mean I do not have access to the repo I'm trying to access, but also missing of resource.
Hence I made an assumption here... During the download of project dependencies, Maven loop through both maven repo (maven google & xxxPRIVATE_REPOxxx) to get the suitable lib. However when it reaches xxxPRIVATE_REPOxxx, it failed to locate maven-metadata.xml therefore result with https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml and 403 Forbidden.
My question:
Should there be a way to indicate which dependency to get from which Maven?
I was imaging something like this
implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+' : xxxPRIVATE_REPOxxx (You know what I mean)
I have tried:
Upgrading my Android-Plugin to 3.5.0
Upgrading my Gradle version to 5.6.4
./gradlew clean and re-build after steps 1 and 2
Turns out the issue was because the react native dependencies use by 3rd party library (react-native-i18n) was too low. You can find it at react-native-i18n's build.gradle.
dependencies {
compile 'com.facebook.react:react-native:0.12.+'
}
Hence my fix to this was update the code to
compile 'com.facebook.react:react-native:+'
In my build.gradle for a Java project, I have a list of Maven repositories I am pointing to for dependency resolution, as follows:
repositories {
maven {
url "https://artifactory.myco.com/artifactory/maven-us-east-1-local"
}
maven {
url "https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local"
}
mavenCentral() }
It looks like the snapshots repo above barfs during resolution when gradle tries to see if a non-snapshot dependency lives there, as it goes through and contacts each repo in order. In artifactory it has been configured with a policy and it sends back a 409 conflict when it gets asked if it has a non-snapshot dependency. This is what I get:
./gradlew build
.
.
.
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all dependencies for configuration > 'com.myco.project:pgs_common:compile'.
Could not resolve mydep:mydep:1.0.9.
Required by:
com.myco.project:pgs_common:1.28.0-SNAPSHOT
Could not resolve mydep:mydep:1.0.9
Could not get resource 'https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local/mydep/mydep/1.0.9/mydep-1.0.9.pom'.
Could not GET > 'https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local/mydep/mydep/1.0.9/mydep-1.0.9.pom'. Received status code 409 from server: Conflict
Is there a way in gradle to tell it to not bother contacting that repo for non-snapshot dependencies? In Maven you can add extra properties in a repository declaration telling Maven whether it allows release dependencies, snapshot dependencies, or both (the default).
Thanks.
I have similar issues with Gradle 4.x and 5.x, the workaround is to use Gradle 2.x.
By using Gradle 2.x does not stop Gradle search non-snapshot libs from release repository, but at least Gradle can find decency.
We have a company-wide Nexus 3 server which
hosts our own artifacts and
is used as proxy to Maven Central and other repos.
The developers use two repositories:
maven-releases for all released/stable artifacts with the version policy "Release" and
maven-snapshots for all snapshots artifacts with the version policy "Snapshot".
Both repositories are used in a Gradle build:
repositories {
maven {
name "snapshots"
url "http://nexus3.server:8081/repository/maven-snapshots"
}
maven {
name "releases"
url "http://nexus3.server:8081/repository/maven-releases"
}
}
Now when Gradle tries to resolve a snapshot-dependency it asks the releases-repository, Nexus answers with
Error 400 Bad Request
Repository version policy: RELEASE does not allow version: 1.0-SNAPSHOT
and the build fails with
> Could not resolve group.id:artifact-id:1.0-SNAPSHOT.
Required by:
:my-project:unspecified
> Could not resolve group.id:artifact-id:1.0-SNAPSHOT.
> Could not get resource 'http://nexus3.server:8081/repository/maven-releases/group/id/artifact-id/1.0-SNAPSHOT/artifact-id-1.0-SNAPSHOT.pom'.
> Could not GET 'http://nexus3.server:8081/repository/maven-releases/group/id/artifact-id/1.0-SNAPSHOT/artifact-id-1.0-SNAPSHOT.pom'. Received status code 400 from server: Bad Request
How do I need to configure Gradle so that this error is ignored and the next repository ("snapshots") is tried? Or is it possible to configure Nexus to return 404 Not Found instead of 400 Bad Request?
Version: Gradle 2.9
Check out the Nexus Repository Manager 3 documentation for gradle usage as well as the example projects. That should show you how to use a init.gradle for downloading from the repository group.
RaGe's comment was a good hint: The dependency was neither in snapshots nor in releases but in a third repository which I was not aware of. After adding the third repository to Gradle the dependency was resolved.
One other issue I found while uploading a build:
Make sure you don't have -SNAPSHOT on your version name while uploading to Staging!
-SNAPSHOT versions are not accepted.