Skip to content

[Java][Spring] Fix duplicate spring-boot-starter-restclient in SB4 POM (Maven 3.10 compat) - #25209

Open
Karan-Rastogi wants to merge 2 commits into
OpenAPITools:masterfrom
Karan-Rastogi:fix-25202-spring-boot-duplicate-restclient
Open

Karan-Rastogi wants to merge 2 commits into
OpenAPITools:masterfrom
Karan-Rastogi:fix-25202-spring-boot-duplicate-restclient

Conversation

@Karan-Rastogi

@Karan-Rastogi Karan-Rastogi commented Oct 9, 2026 •

Copy link
Copy Markdown

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and the Pull Request label is correctly set.
  • Pull Request is based on the master branch of the repository.
  • Ran mvn clean package in the root of the repository and it passed.
  • There is a GitHub issue describing the problem, and this Pull Request fixes it.

PR Type

Bug fix

Description of the changes

The Spring Boot 4 pom.xml template (pom-sb4.mustache) declared spring-boot-starter-restclient (or spring-boot-starter-webclient when reactive=true) twice:

  1. In compile scope (main dependencies), and
  2. In test scope (test dependencies).

Maven 3.10 treats duplicate dependency declarations as a hard error instead of a warning, which breaks any project generated with library=spring-boot and useSpringBoot4=true:


Summary by cubic

Fixes duplicate spring-boot-starter-restclient (or -webclient when reactive=true) declarations in the Spring Boot 4 POM template, which Maven 3.10 rejects as a hard error. Removes the redundant test-scoped declaration; compile scope already covers the test classpath, so resolved dependencies are unchanged. Regenerates the four springboot-4 sample POMs to match.

Written for commit ae5d05e. Summary will update on new commits.

View guided diff

…m SB4 POM

The pom-sb4.mustache template declared spring-boot-starter-restclient (or
-webclient when reactive) twice: once in compile scope and once in test scope.
Maven 3.10 treats duplicate dependency declarations as a hard error, breaking
builds that previously only logged a warning.

Since compile scope is already available on the test classpath, the test-scoped
declaration is redundant. Removing it fixes Maven 3.10 compatibility without
changing resolved dependencies.

Fixes OpenAPITools#25202

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

View guided diff | Re-trigger cubic

@Sekator778 Sekator778 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template change is right: the removed test-scoped starter is the same artifact as the compile one, also with reactive. Samples up-to-date is red because the four springboot-4* sample poms aren't regenerated; ./bin/generate-samples.sh bin/configs/spring-boot-4*.yaml on JDK 17 updates them, then it's good to go.

Regenerated the four springboot-4* sample POMs to reflect the duplicate
spring-boot-starter-restclient removal in pom-sb4.mustache.

Verified locally with:
  mvn clean package -DskipTests
on samples/openapi3/server/petstore/springboot-4 — build succeeds.

Generated with:
  ./bin/generate-samples.sh bin/configs/spring-boot-4*.yaml

Refs OpenAPITools#25202
@Karan-Rastogi

Copy link
Copy Markdown
Author

Thanks for the review @Sekator778

I've regenerated the four springboot-4* sample POMs as you suggested:

./bin/generate-samples.sh bin/configs/spring-boot-4*.yaml

Updated files:

  • samples/openapi3/server/petstore/springboot-4/pom.xml
  • samples/openapi3/server/petstore/springboot-4-jspecify/pom.xml
  • samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/pom.xml
  • samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/pom.xml

All four POMs now contain only a single spring-boot-starter-restclient declaration.

I also verified locally with:

mvn clean package -DskipTests

on samples/openapi3/server/petstore/springboot-4 — BUILD SUCCESS.

Commit: ae5d05e. Please let me know if anything else needs updating. Thanks for your time!

@Sekator778 Sekator778 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The four regenerated poms match my local regeneration byte for byte, LGTM. The GitHub workflows on this head still wait for a maintainer's approval to run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants