Unable to load plugins/dependencies errrors

I am having issues with my plugins not resolving as shown in the below screenshot. I am also having an issue with not being able to run flyway migrations. When I try to run flyway migrate I am getting an error that say database not found at the listed url. I am able to access the database using the integrated database tools in intellij so I know the url is valid. So I think the issue is due to not being able to resolve all the dependencies/plugins.


My build.gradle file is shown below

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id 'org.springframework.boot' version '3.2.1'
    id 'io.spring.dependency-management' version '1.1.4'
    id 'org.jetbrains.kotlin.jvm' version '1.9.21'
    id 'org.jetbrains.kotlin.plugin.spring' version '1.9.21'
    id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.21'
    id 'org.flywaydb.flyway' version '10.4.1'
}

group = 'com.pdrake'
version = '0.0.1-SNAPSHOT'

java {
    sourceCompatibility = '17'
}

repositories {
    mavenCentral()
}
flyway {
    url = 'jdbc:oracle:thin:@//localhost:3000/XEPDB1'
    user = 'pdbadmin'
    password = 'my_password'
    schemas = ['PDBADMIN']
    driver = 'oracle.jdbc.OracleDriver'
    locations = ['classpath:db/migrations']
}
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
    implementation 'org.flywaydb:flyway-core'
    implementation 'org.flywaydb:flyway-database-oracle'
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
    implementation 'org.springframework.session:spring-session-jdbc'
    implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
    runtimeOnly 'com.oracle.database.jdbc:ojdbc11'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

tasks.withType(KotlinCompile) {
    kotlinOptions {
        freeCompilerArgs += '-Xjsr305=strict'
        jvmTarget = '17'
    }
}

tasks.named('test') {
    useJUnitPlatform()
}

The question is more, why it tries to access these jars at all.
Those artifacts are POM-only.
They are just the marker artifacts to resolve a plugin id by naming convention to a code artifact that the marker artifact depends on as in one code artifact there can be arbitrary many plugins.

Do you maybe have something strange in your settings script?
Maybe something that tells to search for artifacts and ignore the poms?
Or maybe you use some transparent mirror that mangles the POM and removes the packaging configuration or something like that?

But anyway, in the end the plugins were available properly as you can see in the following lines, for example the line that tells you that the KGP plugin is used in the gradle82 variant.

Btw. you should replace the Spring dependency management plugin.
It is an obsolete relict from times when Gradle did not have built-in BOM support, by now does more harm than good, and even its maintainer recommends not to use it anymore.

so how do I resolve the database not found error

That’s off-topic here.
You should probably ask in some Flyway community instead. :slight_smile:

But having a quick look at its documentation suggests, that you miss to provide the oracle driver.
You added it to your production dependencies, but that is irrelevant for the Gradle task which also needs it.
So add it to the classpath configuration in the buildscript { dependencies { ... } } block and it should probably work: Quickstart - Gradle - Flyway - Product Documentation

If you have further problems with that plugin, I really recommend reading its documentation or asking in some Flyway related community.

Thanks you were right putting the dependency in the buildscript in did in fact fix the issue

1 Like