Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven: bumpVersion update child pom.xml versions in multi module projects #14703

Open
loadi-dev opened this issue Mar 17, 2022 · 8 comments
Open
Labels
manager:maven Maven (Java) package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@loadi-dev
Copy link

loadi-dev commented Mar 17, 2022

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us what version of Renovate you run.

32.6.1

Please select which platform you are using if self-hosting.

GitLab self-hosted

If you're self-hosting Renovate, tell us what version of the platform you run.

14.8.3

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

Steps to reproduce

  • Set up a repository with a multi maven project with at least one child
  • The child should reference the parent
    • (Background: I use the parent to manage versions for all childs.)
  • Activate bumpVersion for that repository
  • Make renovate update a dependency in the parents POM (e.g. set an older version)

Current behavior

  • Renovate updates the outdated dependency
  • Renovate bumps the version of the parent POM
  • Renovate is not updating the reference to the parent in the child POM
    • Missing this out is breaking the hierarchical structure of my multi maven projects

Expected behavior

  • I'd expect the version bump to update the version as if I'd run mvn versions:set.

Remark
Maybe this is not a bug but an unsupported feature. In that case I'd be glad if this ticket could be converted into a feature request.

Relevant debug logs

Logs ``` INFO: Repository started (repository=golatar-projects/golatar-libs) "renovateVersion": "32.6.1" INFO: Dependency extraction complete (repository=golatar-projects/golatar-libs) "baseBranch": "main", "stats": { "managers": { "gitlabci": {"fileCount": 1, "depCount": 2}, "maven": {"fileCount": 5, "depCount": 25} }, "total": {"fileCount": 6, "depCount": 27} } INFO: Branch created (repository=golatar-projects/golatar-libs, branch=renovate/hibernate.version) "commitSha": "f3fb6c5ba927976a46bb38[37](https://source.16reiche.de/ops/renovate-bot/-/jobs/17819#L37)f6f729da11590308" INFO: PR created (repository=golatar-projects/golatar-libs, branch=renovate/hibernate.version) "pr": 1[51](https://source.16reiche.de/ops/renovate-bot/-/jobs/17819#L51), "prTitle": "Update hibernate.version to v5.6.7.Final" INFO: Repository finished (repository=golatar-projects/golatar-libs) "durationMs": 19576 ```

Have you created a minimal reproduction repository?

No reproduction repository

@loadi-dev loadi-dev added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Mar 17, 2022
@rarkins rarkins added the auto:reproduction A minimal reproduction is necessary to proceed label Mar 21, 2022
@github-actions
Copy link
Contributor

Hi there,

Help us by making a minimal reproduction repository.

Before we can start work on your issue we first need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction to understand what is needed.

We may close the issue if you (or someone else) have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

@rarkins rarkins added the manager:maven Maven (Java) package manager label Mar 21, 2022
@loadi-dev
Copy link
Author

Hi,
I created a repository for reproduction here: https://github.com/loadi-dev/renovate-bumpversion-demo.

I added a minified config.js from my GitLab instance. But I'm not quite sure how to configure it properly on GitHub. The essential parts in my eyes are:

  • Make renovate to handle maven
  • Make renovate to bump the version (bumpVersion: 'patch')

When running renovate on such a repository it will bump the version in the parents perfectly fine, but the child will still refer to the old version. So the updated dependencies will not be effective in the end.

Please feel free to reach out, if you need any additional information.

@rarkins
Copy link
Collaborator

rarkins commented Mar 24, 2022

Please enhance the reproduction to include in the README a description of (a) expected behavior and (b) observed behavior. Ideally (b) should reference a PR in the same repo which shows the current behavior.

@loadi-dev
Copy link
Author

Thanks for your feedback. I updated the repository. Let me know if anything else is missing.

@rarkins
Copy link
Collaborator

rarkins commented Mar 25, 2022

Thanks. The PR shown in your demo is updating the version in the updated Pom.xml exactly as intended/described, so most likely anything beyond that is a feature request and not a bug. Can you add a new commit manually on top of the automated PR to show the changes/differences you'd expect?

@loadi-dev
Copy link
Author

I updated the PR accordingly.

In my opinion the version bump is incomplete for multi module projects. The updated dependency will never be used in the sub module. To work around that I'd need to define the dependency versions in the modules instead of having a central version definition in the parent. This would do for the minimum example, but not for projects with more than one child, sharing some common libraries.

@rarkins rarkins changed the title Maven: bumpVersion does not respect parent dependency for childs in multi module projects Maven: bumpVersion update child pom.xml versions in multi module projects Mar 25, 2022
@rarkins rarkins added type:feature Feature (new functionality) and removed type:bug Bug fix of existing functionality labels Mar 25, 2022
@rarkins
Copy link
Collaborator

rarkins commented Mar 25, 2022

Thanks. You are welcome to submit a documentation PR in the meantime to clarify in our docs that multi module projects aren't currently supported for bumpVersion.

@rarkins rarkins added reproduction:provided priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others and removed auto:reproduction A minimal reproduction is necessary to proceed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Mar 25, 2022
@sta-szek
Copy link

sta-szek commented May 29, 2024

i think the fastest implementation would be to replace this line of code:

bumpedContent = replaceAt(
with smth like mvn versions:set -DnewVersion=${newValue} -DprocessAllModules -DgenerateBackupPoms=false if that is possible to call another cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:maven Maven (Java) package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests

3 participants