'When executing tests with Maven, application.yml is not used
I am working on a simple Spring Boot application, with Maven, latest version. I built some test that use H2. If I run my tests from IntelliJ, they work well.
The problem is when I run my tasts with Maven, they all fail. The error is the same as when application.yml is missing (wrong dialect etc).
Maven does copy the application.yml file.
$ mvn test -X
[...]
[DEBUG] Copying file application.yml
[DEBUG] file application.yml has a filtered file extension
[DEBUG] Using 'UTF-8' encoding to copy filtered resource 'application.yml'.
[DEBUG] copy .../resources/application.yml to .../target/test-classes/application.yml
[...]
[ERROR] Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException
(Wrong dialect?)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement
"CREATE TABLE CV_EXPERIENCE
(CV_ID BIGINT NOT NULL, COMPANY VARCHAR(255),
DESCRIPTION VARCHAR(255), FROM[*] DATE, POSITION VARCHAR(255), TO DATE)"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
