SpringsScala icon indicating copy to clipboard operation
SpringsScala copied to clipboard

Maven Build error "object h2 is not a member of package org"

Open davidcallen opened this issue 6 years ago • 0 comments

Cloned from master. When executing "mvn spring-boot:run" I get error :

[ERROR] /home/david/scala/SpringsScala/src/main/scala/org/springscala/config/H2Config.scala:6: error: object h2 is not a member of package org [ERROR] import org.h2.server.web.WebServlet [ERROR] ^ [ERROR] /home/david/scala/SpringsScala/src/main/scala/org/springscala/config/H2Config.scala:13: error: not found: type WebServlet [ERROR] val registrationBean = new ServletRegistrationBean(new WebServlet)

A SO page refers to the answer which work for me : https://stackoverflow.com/questions/38151447/cannot-import-org-h2-server-web-webservlet With Answer "Shouldn't h2 be a compile (instead of runtime) dependency?"

I changed pom.xml as below diff and then project built and ran :

` git diff diff --git a/pom.xml b/pom.xml index d1a5a57..f804187 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ <groupId>com.h2database</groupId> <artifactId>h2</artifactId>

  •                   <scope>runtime</scope>
    
  •                   <scope>compile</scope>
              </dependency>
              <dependency>
                      <groupId>org.springframework.boot</groupId>
    

`

davidcallen avatar Aug 22 '19 10:08 davidcallen