Gradle doesn't handle dependencies - Java Spring boot

Viewed 33

I'm working on a Spring Boot 2.2.1 project. I use Gradle 6.8.3 as a dependency manager, I'm new to working with Gradle as a deps manager and it's my first time using the h2 engine.

This is my gradle file

plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}

group = 'com.somedomain'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
   mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'com.h2database:h2'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.boot:spring-boot-starter-web'
}

test {
    useJUnitPlatform()
}

In my application.properties I have a path that points to memory H2

application.properties

spring.datasource.url=jdbc:h2:mem:~/biblioteca

Cuando ejecuto mi aplicación, e ingreso la url me genera la siguiente excepción:

IO Exception: null
IO Exception: null [90028-200] 90028/90028 (Help)

I've searched for this on the internet for a few hours, and I have no information about it, something leads me to believe that Gradle is not taking my dependencies. When I bring up my server I get the following in the powershell

     .   ____          _            __ _ _   
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \  
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / / 
 =========|_|==============|___/=/_/_/_/  
 :: Spring Boot ::        (v2.2.1.RELEASE)

2022-09-07 17:01:40.086  INFO 8612 --- [           main] 
c.c.biblioteca.BibliotecaApplication     : Starting BibliotecaApplication 
on LAPTOP-4E9PK22R with PID 8612 
(C:\Users\tomas\OneDrive\Escritorio\projects\proyect\biblioteca\bin\main started by 
tomas in C:\Users\tomas\OneDrive\Escritorio\projects\proyect\biblioteca)
2022-09-07 17:01:40.093  INFO 8612 --- [           main] 
c.c.biblioteca.BibliotecaApplication     : No active profile set, falling 
back to default profiles: default
2022-09-07 17:01:42.423  INFO 8612 --- [           main] 
o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-09-07 17:01:42.613  INFO 8612 --- [           main] 
o.apache.catalina.core.StandardService   : Starting service [Tomcat]      
2022-09-07 17:01:42.692  INFO 8612 --- [           main] 
org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache 
Tomcat/9.0.27]
2022-09-07 17:01:43.227  INFO 8612 --- [           main] o.a.c.c.C.[Tomcat].[localhost]. 
[/]       : Initializing Spring embedded WebApplicationContext
2022-09-07 17:01:43.229  INFO 8612 --- [           main] o.s.web.context.ContextLoader            
: Root WebApplicationContext: initialization completed in 2874 ms
2022-09-07 17:01:43.829  INFO 8612 --- [           main] 
o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 
'applicationTaskExecutor'
2022-09-07 17:01:44.318  INFO 8612 --- [           main] 
o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with 
context path ''
2022-09-07 17:01:44.328  INFO 8612 --- [           main] 
c.c.biblioteca.BibliotecaApplication     : Started BibliotecaApplication in 5.386 
seconds (JVM running for 6.59)

Should dependencies be shown here if I'm not wrong? I already tried with mvn clean install and the server continues to get up the same

1 Answers

Add other h2 properties needed to connect to the database in application.properties

spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=
Related