0
votes

I'm building project using Gradle and legacy ivy repository where jars were built with a custom ivy status. Unfortunately it seems that Gradle has a problem with such statuses thus I'm getting error:

Unexpected status 'DEV' specified for *some_dependecy*:1.0.34. Expected one of: [integration, milestone, release]

Here is how that dependency is defined in build.gradle

compile 'dependency:some_dependecy:1.0.34'

and repository definition

    ivy {
        url 'http://local-repo/ivy-candidates-local/'
        layout 'pattern' , {
            artifact '[organisation]/[module]/[revision]/[type]s/[artifact].[ext]'
            ivy '[organisation]/[module]/[revision]/ivys/ivy.xml'
            m2compatible = true
        }

which I think is fine since all other dependecies (without "custom" statuses) are being downloaded correctly

I couldn't find any information regarding such a problem. Is there a way to tell Gradle to look for custom 'DEV' status instead of the default ones?

1

1 Answers

1
votes

By default Gradle only understands integration, milestone, and release as valid artifact statuses. If you want/need to keep the "DEV" status for your artifact, it looks like you'll have to add a bit of custom Groovy into your build.gradle.

https://docs.gradle.org/current/userguide/customizing_dependency_resolution_behavior.html#sec:component_metadata_rules

(from the above link, not my own code:)

class CustomStatusRule implements ComponentMetadataRule {
    @Override
    void execute(ComponentMetadataContext context) {
        def details = context.details
        if (details.id.group == "org.sample" && details.id.name == "api") {
            details.statusScheme = ["bronze", "silver", "gold", "platinum"]
        }
    }
}

dependencies {
    config3 "org.sample:api:latest.silver"
    components {
        all(CustomStatusRule)
    }
}