I downloaded gradle and made new project with pointing to existing gradle file. Now i wanted to connect to H2.database. Here is my build.gradle file:
plugins {
id 'java'
id 'org.springframework.boot' version '2.0.5.RELEASE'
id "io.spring.dependency-management" version "1.0.6.RELEASE"
}
apply plugin: 'application'
apply plugin: 'idea'
group 'shop.hello.manualgradle'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
mainClassName = 'hello.HelloWorld'
repositories {
mavenCentral()
}
jar {
baseName = 'gs-gradle'
version = '0.1.0'
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'joda-time', name: 'joda-time', version: '2.2'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'com.h2database:h2'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
}
And here is application.properties file which i made both in src/main/resources and in src/test/resources
spring.datasource.name=ecommercedb
spring.jpa.show-sql=true
#H2 settings
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
I run project with gradle idea to update dependencies, then gradlew build and gradlew run. There is no error, but when i go to localhost:8080/h2-console all i get is bad connection. I also tried with gradle build. Why is this happening? I also use IntelIJ and i have build and gradle folders in red, why? I was using this guide: https://www.baeldung.com/spring-angular-ecommerce, but i use own gradle instead of Initializr, and i have Gradle:com.h2.database files in External Libraries so it should work i think! Please, help