1

I am using gradle 7.1.1. I created a Gradle plugin and publishing it into a local nexus repository. The version of the plugin will be of the format 0.1.1-<timestamp>; So each build gets a new version value.

  • In another Github repository, I am using the plugin by using dynamic versioning 0.1.+;
  • When I build and publish the plugin again, the plugin-consuming repository does not resolve the latest version. It resolves to 0.1.1-20211015165344
  • When I replace 0.1.+ with exact version (like 0.1.1-20211018102713)
  • I deleted ~/.gradle folder and also the 0.1.1-20211015165344 version from nexus. However I still get the same error.

build.gradle for plugin

gradlePlugin {
  plugins {
    customPluginTest {
      id = 'custom-plugin-test'
      implementationClass = 'com.mycompany.gradle.CustomPluginTest'
    }
  }
}

settings.gradle from repository using the plugin

  repositories {
      mavenLocal()
        maven {
          url = "${nexus_repo_base}/${nexus_pull_repo_m2}"
          credentials {
            username = nexus_username
            password = nexus_password
          }
        }
      gradlePluginPortal()
    }
  plugins {
    id 'custom-plugin-test' version "${pluginVersion}"
  }
}
  • The pluginVersion is set in gradle.properties to 0.1.+
  • In build.gradle I have not used the version attribute of the plugin.

Debug logs

I tried running gradle with --debug flag but it did not help to find the root cause.

It just had these lines:

243 2021-10-18T10:46:35.478+0530 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Resolve dependencies of detachedConfiguration2'     started
244 2021-10-18T10:46:35.481+0530 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Resolve dependencies of detachedConf    iguration2'
245 2021-10-18T10:46:35.481+0530 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Resolve dependencies of :classpath' started
246 2021-10-18T10:46:35.488+0530 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Download https://localhost/repository/development/com/mycompany/gradle/custom-plugin-test/0.1.1-20211015165344/custom-plugin-test-0.1.1-20211015165344.pom' started

Any thoughts where 0.1.1-20211015165344 version is getting resolved from?

Sundeep Gupta
  • 1,887
  • 3
  • 24
  • 35

0 Answers0