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

Migrate to Spring Boot 3.3 : Flyway 10 migration support #532

Open
ghusta opened this issue May 24, 2024 · 3 comments
Open

Migrate to Spring Boot 3.3 : Flyway 10 migration support #532

ghusta opened this issue May 24, 2024 · 3 comments
Labels
bug Something isn't working recipe Recipe requested

Comments

@ghusta
Copy link

ghusta commented May 24, 2024

What problem are you trying to solve?

Flyway has been upgraded to version 10 with Spring Boot 3.3.

Some changes have to be made for this upgrade, as explained here : https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.3-Release-Notes#flyway-10

Example with Postgresql driver and Flyway

Dependencies needed with Spring Boot 3.2

		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<scope>runtime</scope>
		</dependency>

		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-core</artifactId>
		</dependency>

Dependencies needed with Spring Boot 3.3

		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<scope>runtime</scope>
		</dependency>

		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-database-postgresql</artifactId>
		</dependency>

Testing Spring Initializr

It's already managed with Spring Initializr.
If you had dependencies PostgreSQL Driver and Flyway Migration, the dependency flyway-database-postgresql is automatically added.

Question

Is it possible to conditionally add a Maven dependency, depending of the presence of other dependencies ?

See also

@ghusta ghusta added the bug Something isn't working label May 24, 2024
@timtebeek timtebeek added the recipe Recipe requested label May 24, 2024
@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite May 24, 2024
@timtebeek
Copy link
Contributor

Thanks for bringing this to our attention!

Is it possible to conditionally add a Maven dependency, depending of the presence of other dependencies ?

Yes absolutely! Preconditions are the way to go there; For an example look at how we use DependencyInsight as a precondition here to check for the presence of another dependency, and if found run a different recipe to actually make changes.
openrewrite/rewrite-migrate-java@110db88

I imagine this would only take a couple lines of yaml to resolve; would you be open to add that as a contribution?

@ghusta
Copy link
Author

ghusta commented May 24, 2024

@timtebeek
Copy link
Contributor

Awesome, yes thanks! From the example at openrewrite/rewrite-migrate-java@110db88 I suspect it'll pretty much be a copy and paste with minimal changes. Writing a test could even be optional here, as we're just reusing existing components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working recipe Recipe requested
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants