0

I am building backend application support using Springboot and trying to use h2 database in-built with Spring. However, when I add the below h2 dependency in pom.xml, it's erroring out.

Error

Failed to read artifact descriptor for com.h2database:h2:jar:1.4.200 Dependency 'com.h2database:h2:1.4.200' not found

pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.3.RELEASE com.krishnaQuiz Krishna-Quiz 0.0.1-SNAPSHOT Krishna-Quiz Krishna Quiz UI

<properties>
    <java.version>11</java.version>
</properties>

<dependencies>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
  <version>2.3.4.RELEASE</version>
</dependency>
<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <optional>true</optional>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-test</artifactId>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <scope>runtime</scope>
</dependency>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
============================

Please help

Sneha
  • 1
  • 1
  • 1

2 Answers2

6

I had the same problem ... Specify the H2 version in your pom.xml and wait to update.

<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.200</version>
        <scope>runtime</scope>
</dependency>

An error will appear in the test file, just open it and update the import "CTRL+SHIFT+O" if you use eclipse.

0

I had same problem in my case I resolved it by- in intellij go to maven and simply reload the maven projects it will work or you can use mvn clean install command