renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

[maven]: "allowedVersions": "[1.2.70]" is not work #1000

Closed zbyufei closed 3 years ago

zbyufei commented 3 years ago

Which Renovate are you using?

Renovate Open Source CLI

Which platform are you using?

GitHub.com

Have you checked the logs? Don't forget to include them if relevant

What would you like to do?

My pom.xml:

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.1.20</version>
        </dependency>

My config:

{
  "packageNames": ["com.alibaba:fastjson"],
  "allowedVersions": "[1.2.70]",
  "groupName": "fastjson",
  "groupSlug": "fastjson",
  "updateTypes": ["major", "minor", "patch", "rollback", "pin"],
  "semanticCommitType": "chore",
  "semanticCommitScope": "fastjson",
  "rangeStrategy": "pin",
}

I want set com.alibaba.fastjson vserion == 1.2.70,

https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html: [1.2.70] mean x==1.2.70 https://docs.renovatebot.com/renovate-schema.json: allowedVersions "type": "string"

but, it the pr:

Package Update Change
com.alibaba:fastjson minor 1.1.20 -> 1.2.75

I only want 1.1.20 -> 1.2.70

rarkins commented 3 years ago

Please create a public reproduction repository so we can take a look. Please note that many of the field you have specified in your "config" are only valid within packageRules. Also the JSON you past above is not fully valid JSON either. Therefore, a reproduction repo is required so I can be sure.

zbyufei commented 3 years ago

Please create a public reproduction repository so we can take a look. Please note that many of the field you have specified in your "config" are only valid within packageRules. Also the JSON you past above is not fully valid JSON either. Therefore, a reproduction repo is required so I can be sure.

ths, my repository is: https://github.com/zbyufei/mvn-pin-version-test

zbyufei commented 3 years ago

Please create a public reproduction repository so we can take a look. Please note that many of the field you have specified in your "config" are only valid within packageRules. Also the JSON you past above is not fully valid JSON either. Therefore, a reproduction repo is required so I can be sure.

thinks, please see my repository is: https://github.com/zbyufei/mvn-pin-version-test

rarkins commented 3 years ago

Please run your renovate.json through https://jsonformatter.org/json-pretty-print and then commit a formatted version

zbyufei commented 3 years ago

Please run your renovate.json through https://jsonformatter.org/json-pretty-print and then commit a formatted version

formatted version: https://github.com/zbyufei/mvn-pin-version-test/blob/main/renovate.json

rarkins commented 3 years ago

There's a few things potentially going wrong at once, as it's quite a large config.

First point: you disable major updates here but then in the remainder of your config you have references to major updates. What are you wanting to do with major - disable them, or have them?

Second point: avoid nesting objects inside packageRules like this. Please use updateTypes within packageRules instead.

Third point: you shouldn't need to define groupName and groupSlug so much. There seem to be some added in unnecessary places.

Something else you can do: please add a description string to each package rule describing what you're trying to do with it. Then I may not need to ask you for each in future.

You originally asked about the fastjson rule specifically. I think you just need this:

    {
      "packageNames": [
        "com.alibaba:fastjson"
      ],
      "allowedVersions": "[1.2.70]",
      "semanticCommitType": "chore",
      "semanticCommitScope": "fastjson"
    }

But if you are already on 1.2.70 anyway and you simply don't want to ever update it, it's simpler to just disable it:

    {
      "packageNames": [
        "com.alibaba:fastjson"
      ],
      "enabled": false
    }
zbyufei commented 3 years ago

Thanks