Avoiding maven repository version collision when using feature branches

前端 未结 4 1672
粉色の甜心
粉色の甜心 2021-02-04 07:54

Question: How do you handle feature branches for maven multi project builds?

Jenkins builds and deploys these branches to keep build overhead on develop

4条回答
  •  我寻月下人不归
    2021-02-04 08:25

    We use a similar technique as Peter Kahn, modifying the version of the branch before building. We have three steps in our "Pre Steps":

    1. Execute shell: echo VERSION=$(echo ${GIT_BRANCH} | sed 's_^.*\/__') > env.properties
    2. Inject environment variables: env.properties
    3. Invoke top level Maven targets: versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION}-SNAPSHOT

    I am quite sure that this can be done with two or even one and only step as well, bit the principe behind it will be the same.

    The reason why we don't change the version in the pom.xml files in the branch directly is indeed merging. With SVN this was possible (merging with --accept-mine-conflict. With GIT this does not exist anymore, so we stopped changing versions and created this pre-build steps.

提交回复
热议问题