Gradle plugin repository in artifactory virtual repository not working

I have a project, with settings.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. Please help. I’m using gradle-7.6.4 with JAVA 17.

https://www.linen.dev/s/gradle-community/t/26864600/i-have-a-project-with-settings-gradle-and-build-gradle-like-#6672ea30-d9dd-4172-99cf-981285c38363

1 Like

I was looking for a way to extract our discussion and paste it here… glad you did it… but how can i do it? I don’t want to hijack the thread but just want to know for my future reference…

Just go to Gradle Community #community-support search the thread and copy the link

1 Like