Maven artifact version for patches

前端 未结 3 1967
南笙
南笙 2021-02-09 19:32

I\'m currently working on Maven tools for Project Dash. One of the open issues is how to handle mistakes.

Maven central says: Nothing published ever changes. This is bec

相关标签:
3条回答
  • 2021-02-09 20:11

    The convention for version numbers is major.minor.build.

    major is incremented when the public interface changes incompatibly. For example, a method is removed, or its signature changes. Clients using your library need to take care when using a library with a different major version, because things may break.

    minor is incremented when the public interface changes in a compatible way. For example, a method is added. Clients do not need to worry about about using the new version, as all the functions they are used to seeing will still be there and act the same.

    build is incremented when the implementation of a function changes, but no signatures are added or removed. For example, you found a bug and fixed it. Clients should probably update to the new version, but if it doesn't work because they depended on the broken behavior, they can easily downgrade.

    The tricky issue here is that it sounds like you are modifying code written and released by somebody else. The convention here, as I have seen it, is to postfix the version number with either -yourname-version or just -version. For example, linux-image-2.6.28-27 is a likely name of a Ubuntu kernel image.

    As Maven uses dashes to differentiate between artifact coordinates, however, I would recommend (very long-windedly, apparently) to just add .version to avoid confusing it. So 3.6.2.1 in this case.

    0 讨论(0)
  • 2021-02-09 20:20

    Maven project versions are specified like this.

    <major version>.<minor version>.<incremental version>-<qualifier>
    

    As you do not want to change the version number you are looking for a qualifier. I do not know if there is a general recommendation for the name of the qualifier. The Spring people e.g. did something like this

    2.5.6.SEC01
    2.5.6.SR02
    3.0.0.M3
    

    They didn't use the hyphen/dash notation to seperate the qualifier.

    What ever you do, you have to be careful regarding the ordering of versions! Have a look at the first link I added.

    Update: Also have a look at @krzyk comment for recent changes/additions.

    0 讨论(0)
  • 2021-02-09 20:20

    This is because Maven never tries to figure out whether a release has changed

    That's in my opinion not the basic reason. The reason is to have reliable builds in the future. You define the versions in your pom and that's it. If someone would remove artifacts from maven central or become worse changing an existing artifact you can't be sure that your build will be working in the future...or an older build would work.

    The version number is up to you...i would suggest to use 3.6.2.1.

    0 讨论(0)
提交回复
热议问题