I have a Spring Boot application that runs properly when I run it from Intellij as maven configurations.
I have a project structure of environments that is defined with properties files.
java.io.FileNotFoundException: conf\general.properties (The system cannot find the path specified)
2017-07-11 10:52:52.864 INFO 17896 --- [main] n.lifecycle: Can't find configuration file [conf\general.properties]
2017-07-11 10:52:52.865 ERROR 17896 --- [main] n.lifecycle: configuration file [null] not found (use default properties as error handling)
I've found out what's wrong.
Our in-house framework that's loading the resources are using
File.separator to read the path of the resources.
Now for some reason when the jar is created with maven spring boot plugin the classpath is built with '/' for example
/C:/Users/MyUser/Projects/MyApp/target/MyApp-1.0.1.jar!/BOOT-INF/classes!/ (the resources are in classes path inside of the jar of course)
And when we are trying to run the jar it's trying to read the resources with '\' so the path that is built is (if we choose "dev" for example)
/C:/Users/MyUser/Projects/MyApp/target/MyApp-1.0.1.jar!/BOOT-INF/classes!/conf\dev and that is why the app is failing to load.
I still don't know why this is happening.