Skip to content

Do not use version ranges when publishing artifacts #2087

@idelpivnitskiy

Description

@idelpivnitskiy

Starting from version 1.80, org.bouncycastle published artifacts use version ranges when reference other bouncycastle modules. Example: https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on/1.80

Some build tools and plugins do not support this format and fail with an exception. Here is an example from Gradle project:

   > Could not resolve org.bouncycastle:bcutil-jdk18on:[1.80,1.81).
     Required by:
         project > org.bouncycastle:bcpkix-jdk18on:1.80
         project > org.bouncycastle:bctls-jdk18on:1.80
      > Failed to list versions for org.bouncycastle:bcutil-jdk18on.
         > Unable to load Maven meta-data from https://repo1.maven.org/maven2/org/bouncycastle/bcutil-jdk18on/maven-metadata.xml.
            > org.xml.sax.SAXNotRecognizedException: Property 'http://javax.xml.XMLConstants/property/accessExternalSchema' is not recognized.
      > Failed to list versions for org.bouncycastle:bcutil-jdk18on.
         > Unable to load Maven meta-data from https://repo1.maven.org/maven2/org/bouncycastle/bcutil-jdk18on/maven-metadata.xml.
            > org.xml.sax.SAXNotRecognizedException: Property 'http://javax.xml.XMLConstants/property/accessExternalSchema' is not recognized.

Workaround is to enforce a single version via resolutionStrategy:

allprojects {
    configurations.all {
        resolutionStrategy.eachDependency {
            if (requested.group == "org.bouncycastle" && requested.name.contains("jdk18on") &&
                requested.version?.startsWith('[') == true) {
                useVersion(Versions.bouncycastle)
            }
        }
    }
}

I could not find what commit caused this change between 1.79 and 1.80. Consider reverting behavior for the next release to how it was before (specify exact version number): https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on/1.79

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions