Skip to content

Wrapping the adding of the dependency for org.projectlombok:lombok-mapstruct-binding in a check to make sure you do not already have said dependency (potentially in another scope)#944

Merged
steve-aom-elliott merged 2 commits intomainfrom
1632-fixing-duplicate-lombok-mapstruct-binding-add
Nov 17, 2025
Merged

Wrapping the adding of the dependency for org.projectlombok:lombok-mapstruct-binding in a check to make sure you do not already have said dependency (potentially in another scope)#944
steve-aom-elliott merged 2 commits intomainfrom
1632-fixing-duplicate-lombok-mapstruct-binding-add

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

What's changed?

Previously there was a scenario wherein if you already had dependencies on org.projectlombok:lombok and org.mapstruct:mapstruct as well as a dependency on org.projectlombok:lombok-mapstruct-binding (at provided scope for example (which would be best practice), it would end up adding org.projectlombok:lombok-mapstruct-binding at compile scope (as scope was not provided).

This change checks to make sure you just don't have the dependency at all now prior to calling the Maven AddDependency to add org.projectlombok:lombok-mapstruct-binding.

What's your motivation?

Was causing duplicate dependencies.

Anything in particular you'd like reviewers to focus on?

Possible that it would be better to be more specific about which scopes we want to consider for the precondition, though I don't think I've ever seen someone add lombok-mapstruct-binding in test scope for example, so it might be fine.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

…apstruct-binding` in a check to make sure you do not already have said dependency (potentially in another scope)
@steve-aom-elliott steve-aom-elliott self-assigned this Nov 14, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Nov 14, 2025
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Nov 14, 2025
@steve-aom-elliott steve-aom-elliott merged commit f13464e into main Nov 17, 2025
2 checks passed
@steve-aom-elliott steve-aom-elliott deleted the 1632-fixing-duplicate-lombok-mapstruct-binding-add branch November 17, 2025 13:43
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Nov 17, 2025
mergify bot added a commit to robfrank/linklift that referenced this pull request Nov 24, 2025
…21.2 to 3.22.0 [skip ci]

[//]: # (dependabot-start)
⚠️ \*\*Dependabot is rebasing this PR\*\* ⚠️
Rebasing might not happen immediately, so don't worry if this takes some time.
Note: if you make any changes to this PR yourself, they will take precedence over the rebase.
---
[//]: # (dependabot-end)
Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.21.2 to 3.22.0.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-migrate-java's releases](https://github.com/openrewrite/rewrite-migrate-java/releases).*

> 3.22.0
> ------
>
> What's Changed
> --------------
>
> * Handle `JaxbAnnotationIntrospector` and `JacksonJsonProvider` in migration by [`@​CalvinZengyi`](https://github.com/CalvinZengyi) in [openrewrite/rewrite-migrate-java#936](https://github.com/openrewrite/rewrite-migrate-java/pull/936)
> * Also change Gradle classifier for Apache Shiro by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#939](https://github.com/openrewrite/rewrite-migrate-java/pull/939)
> * Remove dependency version upgrade for commons-fileupload by [`@​hendrikebbers`](https://github.com/hendrikebbers) in [openrewrite/rewrite-migrate-java#943](https://github.com/openrewrite/rewrite-migrate-java/pull/943)
> * Convert `Iterables.all(Collection, Predictate)` into `.stream().allMatch(Predicate)` by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#945](https://github.com/openrewrite/rewrite-migrate-java/pull/945)
> * Wrapping the adding of the dependency for `org.projectlombok:lombok-mapstruct-binding` in a check to make sure you do not already have said dependency (potentially in another scope) by [`@​steve-aom-elliott`](https://github.com/steve-aom-elliott) in [openrewrite/rewrite-migrate-java#944](https://github.com/openrewrite/rewrite-migrate-java/pull/944)
> * Update jakarta-ee-10.yml by [`@​ChenyuWang98`](https://github.com/ChenyuWang98) in [openrewrite/rewrite-migrate-java#946](https://github.com/openrewrite/rewrite-migrate-java/pull/946)
> * Use ChangeType for classes renamed in fastjson2 by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#948](https://github.com/openrewrite/rewrite-migrate-java/pull/948)
>
> New Contributors
> ----------------
>
> * [`@​CalvinZengyi`](https://github.com/CalvinZengyi) made their first contribution in [openrewrite/rewrite-migrate-java#936](https://github.com/openrewrite/rewrite-migrate-java/pull/936)
> * [`@​hendrikebbers`](https://github.com/hendrikebbers) made their first contribution in [openrewrite/rewrite-migrate-java#943](https://github.com/openrewrite/rewrite-migrate-java/pull/943)
>
> **Full Changelog**: <openrewrite/rewrite-migrate-java@v3.21.2...v3.22.0>


Commits

* [`fadd76b`](openrewrite/rewrite-migrate-java@fadd76b) OpenRewrite recipe best practices
* [`0018845`](openrewrite/rewrite-migrate-java@0018845) Use ChangeType for classes renamed in fastjson2 ([#948](https://github.com/openrewrite/rewrite-migrate-java/issues/948))
* [`0208055`](openrewrite/rewrite-migrate-java@0208055) Update jakarta-ee-10.yml ([#946](https://github.com/openrewrite/rewrite-migrate-java/issues/946))
* [`f13464e`](openrewrite/rewrite-migrate-java@f13464e) Wrapping the adding of the dependency for `org.projectlombok:lombok-mapstruct...
* [`a272a5a`](openrewrite/rewrite-migrate-java@a272a5a) Update documentation examples
* [`7112826`](openrewrite/rewrite-migrate-java@7112826) [Auto] SDKMAN! Java candidates as of 2025-11-17T1017
* [`b17a592`](openrewrite/rewrite-migrate-java@b17a592) Convert `Iterables.all(Collection, Predictate)` into `.stream().allMatch(Pred...
* [`c47788e`](openrewrite/rewrite-migrate-java@c47788e) Add `AnnotateRequiredParameters` to `JSpecifyBestPractices`
* [`43d728a`](openrewrite/rewrite-migrate-java@43d728a) Remove dependency version upgrade for commons-fileupload ([#943](https://github.com/openrewrite/rewrite-migrate-java/issues/943))
* [`5c0539e`](openrewrite/rewrite-migrate-java@5c0539e) Also change Gradle classifier for Apache Shiro ([#939](https://github.com/openrewrite/rewrite-migrate-java/issues/939))
* Additional commits viewable in [compare view](openrewrite/rewrite-migrate-java@v3.21.2...v3.22.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.openrewrite.recipe:rewrite-migrate-java&package-manager=maven&previous-version=3.21.2&new-version=3.22.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lombok test provided

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants