Following scenario:
- spring boot 2.0.4 application
- maven 3
- IntelliJ 2018.1
I have a spring boot application that has a "local" profile and should use an in-memory hsql database.
I have declared hsqldb
as dependency with scope test, as I do not need it in production.
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
I know that when I manually create a classic Java Runner class, bootstrapping my spring boot application under my src/test
directory, the dependency will get recognized and everything works fine.
But when I run my spring boot application locally via a Run Configuration/ Dashboard from IntelliJ it will not work.
So when I start the spring boot application, I will get the expected ClassNotFoundException.
Is there any way to let my spring boot application start in IntelliJ even with this test scoped dependency?
UPDATE
Defining the hsqldb dependency as scope runtime allowed to start from inside IntelliJ, but the hsqldb.jar got packaged in the final war file too....
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
<configuration>
<excludes>
<exclude>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>