mardi 16 février 2021

Springboot & maven - Changing datasource configuration with maven command

In my project (springboot, maven), I have tests annotated with @TestPropertySource({"classpath:flyway.properties", "/queries/test.properties"}) to override some properties related to my datasource. I run the test with mvn clean test command.

Now I would like to add a new stage to my Jenkins pipeline to perform my tests on two different data sources.

Is there a way to overwrite the values in my file (test.properties) when I run the maven command? Or could I use two different files with spring profiles or something like :

@TestPropertySource({"classpath:flyway.properties", "/queries/test-${env/profile}.properties"})

Any insight would be gratefully appreciated. Cheers!

Aucun commentaire:

Enregistrer un commentaire