Every time i try to build or run from gradle (gradle bootRun or ./gradlew bootRun), while importing io.r2dbc.postgresql.codec.Json, i get this error:
Stack trace> Task :compileJava FAILED
/home/repos/test-backend/src/main/java/com/dnt/backend/BackendApplication.java:3: error: package io.r2dbc.postgresql.codec does not exist
import io.r2dbc.postgresql.codec.Json;
^
1 error
Steps to reproduce
package com.test.backend;
import io.r2dbc.postgresql.codec.Json;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BackendApplication {
public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
Json test = Json.of("testing");
System.out.println(test);
}
}
build.gradle:
plugins {
id 'org.springframework.boot' version '2.6.7'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '18'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'io.r2dbc:r2dbc-postgresql'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
tasks.named('test') {
useJUnitPlatform()
}
Expected behavior/code
When i debug-run the project from the IDE (vscode) it works and prints the Json object.
Versions
- Driver: 0.8.12
- Database: 14.2
- Java: 18
- OS: Linux 5.10
- Gradle: 7.4.2