What is the best way to get database password to integration tests using Maven?
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
精彩评论