Sreenivas
01/16/2025, 5:03 PMsettings.gradle
and build.gradle
like this:
settings.gradle
pluginManagement {
repositories {
maven {
url = '
<http://myserver/artifactory/pg-Thirdparty>'
allowInsecureProtocol = true
metadataSources {
mavenPom()
artifact()
gradleMetadata()
}
}
// Fallback to Gradle Plugin Portal
//gradlePluginPortal()
// Optionally add Maven Central as a fallback
//mavenCentral()
}
}
build.gradle
plugins {
id "java"
id("org.sonarqube") version "6.0.1.5171"
//id("com.github.seanrl.jaxb") version "2.5.5"
//id("com.diffplug.spotless") version "7.0.2"
//id "com.osacky.doctor" version "0.10.0"
//id("com.github.pt-osda.java-dependencies-analysis") version "1.0.4"
//id("org.sonarqube") version "6.0.1.5171"
//id("io.github.gmazzo.importclasses") version "1.1.0"
//id("com.autonomousapps.dependency-analysis") version "2.7.0"
}
whereas pg-Thirdparty
is a virtual repo configured with maven central repo and gradle plugin repo (https://plugins.gradle.org/m2/) but plugins not getting downloaded via our org artifactory.
If i uncomment //gradlePluginPortal()
it just works , but we are not supposed to use like this. Tried all my ways to fix this, unfortunately couldn’t find a reason for this.
Some plugins its working but some its not working. For example, in above //id "com.osacky.doctor" version "0.10.0"
this works if i uncomment but sonarqube
plugin not working. Getting below error:
```
```> Could not resolve all files for configuration ':classpath'.
> Could not find org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:6.0.1.5171.
Searched in the following locations:
- http:
//myserver/artifactory/pg-Thirdparty/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/6.0.1.5171/sonarqube-gradle-plugin-6.0.1.5171.pom
- <http://myserver/artifactory/pg-Thirdparty/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/6.0.1.5171/sonarqube-gradle-plugin-6.0.1.5171.module>
- <http://myserver/artifactory/pg-Thirdparty/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/6.0.1.5171/sonarqube-gradle-plugin-6.0.1.5171.jar>
Required by:
project : > org.sonarqube:org.sonarqube.gradle.plugin:6.0.1.5171
There is no issue with connectivity from our artifactory server to gradle plugins repository.
Please note im able to use plugins in older format like buildscript{}
block with dependencies declaration but its failing only with plugins{}
block.
Couldn’t figure out if this is issue with our artifactory configuration or gradle build configuration. I’m using gradle-7.6.4
with JAVA 17.Vampire
01/16/2025, 11:47 PMSome plugins its working but some its not working. For example, in aboveOsacky Doctor plugin in that version is not published to GPP but MC, SQ plugin in that version is not published to MC but GPP. So that difference would indeed hint at the connection of your mirror to GPP is the problem. Maybe try to resolve a different version of SQ plugin, maybe you requested the new version when it was not yet available and your mirror remembers that and does not recheck. If for examplethis works if i uncomment but//id "com.osacky.doctor" version "0.10.0"
plugin not working.sonarqube
6.0.0.5145
works.Sreenivas
01/17/2025, 5:39 AM3.3
version which is in MC, it worked.. but surely there's no connection issue i feel.. because when we added gradle plugin repo to our virtual repo, there is a Test option in jfrog artifactory UI and it said 'connection successful'. One more strange thing i observed, if i comment out pluginManagement
block in settings.gradle
, its able to download the all the plugin versions which are present only in GPP too. I'm confused.. I'm not sure why its failing when i have pluginManagement
block with our repo URLs in settings.gradle
. Also one more thing i missed mentioning.. i have one initscript.gradle
which has buildscript block like this:
buildscript {
repositories {
maven {
url "<http://myserver/artifactory/pg-Thirdparty>"
allowInsecureProtocol = true
}
}
}
So if i remove pluginManagent
block in settings.gradle
, is it considering initscript
configuration to download plugins? but if that is true, why the same piece of configuration not working when i have it in settings.gradle
.. This all behavior i observed in my local machine ie., removing pluginManagement
block working fine, when checked log, looks like its directly connecting to GPP for which we have connectivity from our local machines.
If remove pluginManagement
block its failing in gitlab runners becoz runners don't have connectivity to thirdparty repos like MC, GPP etc, for the same reason we are adding thirdparty repos to our virtual repository and using the same. For plugins which are present in MC its working even in runners via our artifactory.. but which are present only in GPP, its failing via our artifactory.. but conn showing as successfull .. totally confused.. 😕Sreenivas
01/17/2025, 7:33 AMVampire
01/17/2025, 10:05 AMthere is a Test option in jfrog artifactory UI and it said 'connection successful'.Just that it can connect does not mean it can download. And even if it could, the actual artifacts are on some CDN servers, so your setup has to follow the redirects it gets. It would be the same if you previously had used the Osacky Doctor plugin and only had GPP as plugin repository and only enabled GPP but not MC on your mirror. Because GPP sends redirects to MC for all things it does not host itself. So Osacky Doctor plugin would resolve from GPP but not from your mirror if it does not follow redirects.
One more strange thing i observed, if i comment outWhy? GPP is the default. nothing => GPP anything => only what is added explicitlyblock inpluginManagement
, its able to download the all the plugin versions which are present only in GPP too. I'm confused..settings.gradle
Documentation just says 'plugins.gradle.org' Looks like documentation need to be updated. 🙂I'm not sure which part of the docs you are referring to, so I don't know what exactly it says. But I guess it says you "need to be able to download from plugins.gradle.org" or "you need to mirror plugins.gradle.org" or similar, which is correct and sufficient imho. Because if you proxy requests to plugins.gradle.org, following redirects, and cache the result this is enough and fine. That you additionally have a firewall that blocks access to other domains which are an implementation detail of the plugin portal is a different topic and imho that does not belong to the docs, as this could also easily change as it is an implementation detail of the server and not "part of its API". But feel free to open a ticket, could well be that Gradle folks agree with you and add the information. 🤷♂️
Sreenivas
01/17/2025, 10:19 AM<http://plugins-artifacts.gradle.org|plugins-artifacts.gradle.org>
to fetch actual plugin contents, which is failing as we didn't whitelist this at our org proxy.
So i'm just saying it would be good if document says about these redirection details so that we can get network changes done at once 🙂
But yeah what you said also right, its internal to gradle plugin portal stuff which might change any time.Vampire
01/17/2025, 11:12 AM