samedi 22 février 2020

Quarkus in test profile has a different working directory than in development mode, creating path problems accessing resource files

Having a file.txt inside the resources folder. And having a Bean to load that file on the Application start lifecycle:

In Development profile when compiled and running the resources folder is copied into the build (or target with maven) directory and the working dir is relative to the resources file so no need of special path or what so ever.

So basically is enough to have defined the filename in the application.properties.


In Test profile instead the working dir is the project root, so that file cannot be found anymore without giving the full relative path into the resources folder.

Is there any way to tell Quarkus test profile, and/or Microprofile config annotation, to lookup in resources folder to load some resources when needed?

I did not find anything apart a work-around to this not tidy profile difference.

Aucun commentaire:

Enregistrer un commentaire