Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish Gradle metadata #23503

Closed
bclozel opened this issue Aug 22, 2019 · 3 comments
Closed

Publish Gradle metadata #23503

bclozel opened this issue Aug 22, 2019 · 3 comments
Assignees
Labels
type: task A general task
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Aug 22, 2019

As of its 5.3 version, Gradle is able to generate and consume Gradle-specific build metadata. It's an opt-in feature for now, but it will be enabled by default with Gradle 6.0.

Should we produce and publish this metadata for our 5.2.0 release?

Here is the module.json file published for spring-webflux:

{
  "formatVersion": "1.0",
  "component": {
    "group": "org.springframework",
    "module": "spring-webflux",
    "version": "5.2.0.BUILD-SNAPSHOT",
    "attributes": {
      "org.gradle.status": "integration"
    }
  },
  "createdBy": {
    "gradle": {
      "version": "5.6",
      "buildId": "tnw2jjpho5a5jfyvqcxsiinl3u"
    }
  },
  "variants": [
    {
      "name": "apiElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 8,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-api",
        "org.jetbrains.kotlin.localToProject": "public",
        "org.jetbrains.kotlin.platform.type": "jvm"
      },
      "dependencies": [
        {
          "group": "org.springframework",
          "module": "spring-beans",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-core",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-web",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "io.projectreactor",
          "module": "reactor-core",
          "version": {
            "requires": "3.3.0.M3"
          }
        }
      ],
      "files": [
        {
          "name": "spring-webflux-5.2.0.BUILD-SNAPSHOT.jar",
          "url": "spring-webflux-5.2.0.BUILD-SNAPSHOT.jar",
          "size": 812464,
          "sha1": "2ba63ce11e96bccd35154fdc683101bd3414bc56",
          "md5": "7ed44177912810577066d4e262f8273d"
        }
      ]
    },
    {
      "name": "runtimeElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 8,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-runtime",
        "org.jetbrains.kotlin.localToProject": "public",
        "org.jetbrains.kotlin.platform.type": "jvm"
      },
      "dependencies": [
        {
          "group": "org.springframework",
          "module": "spring-beans",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-core",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-web",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "io.projectreactor",
          "module": "reactor-core",
          "version": {
            "requires": "3.3.0.M3"
          }
        }
      ],
      "files": [
        {
          "name": "spring-webflux-5.2.0.BUILD-SNAPSHOT.jar",
          "url": "spring-webflux-5.2.0.BUILD-SNAPSHOT.jar",
          "size": 812464,
          "sha1": "2ba63ce11e96bccd35154fdc683101bd3414bc56",
          "md5": "7ed44177912810577066d4e262f8273d"
        }
      ]
    }
  ]
}

Here is the module.json file for our Java Platform (also exported as a Maven BOM):

{
  "formatVersion": "1.0",
  "component": {
    "group": "org.springframework",
    "module": "spring-framework-bom",
    "version": "5.2.0.BUILD-SNAPSHOT",
    "attributes": {
      "org.gradle.status": "integration"
    }
  },
  "createdBy": {
    "gradle": {
      "version": "5.6",
      "buildId": "536e76sdo5cndbduo2qqzgbcja"
    }
  },
  "variants": [
    {
      "name": "apiElements",
      "attributes": {
        "org.gradle.category": "platform",
        "org.gradle.usage": "java-api"
      },
      "dependencyConstraints": [
        {
          "group": "org.springframework",
          "module": "spring-aop",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-aspects",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-beans",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context-indexer",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context-support",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-core",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-expression",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-instrument",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jcl",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jdbc",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jms",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-messaging",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-orm",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-oxm",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-test",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-tx",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-web",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-webflux",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-webmvc",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-websocket",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        }
      ]
    },
    {
      "name": "runtimeElements",
      "attributes": {
        "org.gradle.category": "platform",
        "org.gradle.usage": "java-runtime"
      },
      "dependencyConstraints": [
        {
          "group": "org.springframework",
          "module": "spring-aop",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-aspects",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-beans",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context-indexer",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-context-support",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-core",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-expression",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-instrument",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jcl",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jdbc",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-jms",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-messaging",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-orm",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-oxm",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-test",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-tx",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-web",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-webflux",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-webmvc",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        },
        {
          "group": "org.springframework",
          "module": "spring-websocket",
          "version": {
            "requires": "5.2.0.BUILD-SNAPSHOT"
          }
        }
      ]
    }
  ]
}

Note that all the generated POMs are slightly changed with the following:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do-not-remove: published-with-gradle-metadata -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.springframework</groupId>
  <artifactId>spring-framework-bom</artifactId>
@bclozel bclozel added this to the 5.2 RC2 milestone Aug 22, 2019
@bclozel bclozel self-assigned this Aug 22, 2019
@bclozel bclozel closed this as completed in 1b68144 Sep 3, 2019
@bclozel bclozel reopened this Sep 4, 2019
@bclozel
Copy link
Member Author

bclozel commented Sep 4, 2019

See jfrog/build-info#247

@bclozel bclozel modified the milestones: 5.2 RC2, 5.2 GA Sep 4, 2019
@bclozel bclozel modified the milestones: 5.2 GA, 5.x Backlog Sep 16, 2019
@bclozel bclozel added the status: blocked An issue that's blocked on an external project change label Sep 30, 2019
@bclozel bclozel removed the status: blocked An issue that's blocked on an external project change label Nov 28, 2019
@bclozel bclozel modified the milestones: 5.x Backlog, 5.2.2 Nov 28, 2019
@bclozel
Copy link
Member Author

bclozel commented Dec 2, 2019

Reverting and reopening since publishing Gradle metadata seems to fails for a combination of "Gradle < 6.0" and "using the spring dependency management plugin". Here's a repro project:

plugins {
    id 'java'
    id "io.spring.dependency-management" version "1.0.8.RELEASE"
}

repositories {
  mavenCentral()
  maven { url 'https://repo.spring.io/milestone' }
  maven { url 'https://repo.spring.io/snapshot' }
}

dependencyManagement {
     imports {
          mavenBom 'org.springframework:spring-framework-bom:5.2.2.BUILD-SNAPSHOT'
     }
}

dependencies {
  implementation 'org.springframework:spring-core'
}

task testbom {

 doLast {
   def managedVersions = dependencyManagement.managedVersions
   def springCoreVersion = managedVersions['org.springframework:spring-core']
   println springCoreVersion
 }

}

This is failing with:

> Task :testbom FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/bclozel/workspace/tmp/gradle-metadata/build.gradle' line: 25

* What went wrong:
Execution failed for task ':testbom'.
> Could not resolve all dependencies for configuration ':detachedConfiguration1'.
   > Could not resolve org.springframework:spring-framework-bom:5.2.2.BUILD-SNAPSHOT.
     Required by:
         project :
      > Cannot choose between the following variants of org.springframework:spring-framework-bom:5.2.2.BUILD-SNAPSHOT:
          - enforcedRuntimeElements
          - runtimeElements
        All of them match the consumer attributes:
          - Variant 'enforcedRuntimeElements' capability org.springframework:spring-framework-bom:5.2.2.BUILD-SNAPSHOT:
              - Unmatched attributes:
                  - Found org.gradle.category 'enforced-platform' but wasn't required.
                  - Found org.gradle.status 'integration' but wasn't required.
                  - Found org.gradle.usage 'java-runtime' but wasn't required.
          - Variant 'runtimeElements' capability org.springframework:spring-framework-bom:5.2.2.BUILD-SNAPSHOT:
              - Unmatched attributes:
                  - Found org.gradle.category 'platform' but wasn't required.
                  - Found org.gradle.status 'integration' but wasn't required.
                  - Found org.gradle.usage 'java-runtime' but wasn't required.

As this combination (Gradle version and plugin) is quite popular, I'm unpublishing this metadata for now. We might consider publishing that now in a future minor version as we're moving on with the maintenance versions in this branch.

@bclozel
Copy link
Member Author

bclozel commented Apr 29, 2020

Closed with 9bd60f6

@bclozel bclozel closed this as completed Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

1 participant