开发者

What is the best way to get database password to integration tests using Maven?

开发者 https://www.devze.com 2023-01-28 11:00 出处:网络
We are using Maven and Spring and current execute our tests by using Sy开发者_JAVA技巧stem properties and test with this line.

We are using Maven and Spring and current execute our tests by using Sy开发者_JAVA技巧stem properties and test with this line.

mvn -Ddbuser=username -Ddbpassword=password test

In the past I had utilized environment variables but I read that support was going away in maven so figured it may be a bad practice.


You could store the password as property in the settings.xml file. Now, if storing it in a clear text bugs you as much as me, there is the --encrypt-password option for the maven that you can then store the password in the settings.xml encrypted in a profile, server, or some other section for use in your integration tests. Here's the link to the documentation on how to configure this:

http://maven.apache.org/guides/mini/guide-encryption.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号