I am using Spring boot 2.7.5 and included dependency Flyway core 7.15.0 to execute migrations script on Psotgresql-9.6 but The IntelliJ-Idea external dependencies show Flyway core dependency 7.15.0 and Flyway core dependency 8.5.3 which I never mentioned in any of my gradle.build file ,how can I exclude this
Migration module gradle.build
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-cassandra")
implementation("org.cognitor.cassandra:cassandra-migration-spring-boot-starter:2.5.0_v4")
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation ('org.springframework.boot:spring-boot-starter-web')
implementation 'org.flywaydb:flyway-core:7.15.0'
}

This is likely a transitive dependency. For instance, if you have a multi-module Project, that might be a dependency of one of the Modules. IDEA offers a lot of options to analyze dependencies in your Project, see if any of those would be helpful for you. You can also run "gradle dependencies" from command prompt if you are looking for the raw Gradle output.
If you're specifically looking to exclude a dependency - refer to Gradle Documentation.