How can I use encrypted password in pom.xml with maven 3?
I have some pom that use password that are very delicated for us, for example we have POM to deploy in Application servers such as Weblogic or run Scripts in the database, and we don't like to just put the password as it is.
I already have the master password for deployment artifacts.
I am thinking if there is a way for example to generate a password:
$ mvn --encrypt-password somepass
{wGpHaPO3nJ4HSKJa7qcMK9qjHAdwlvMrtjYjj8bwguI=}
And after that Can I use it in some pom in this way:
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:@ordbsdev.siman.com:1521:RMSDEV</url>
<username>${siman.rms13.db.user}</username>
<password>{wGpHaPO3nJ4HSKJa7qcMK9qjHAdwlvMrtjYjj8bwguI=}</password>
</configuration>
Also, I would appreciate an alternative to do it.
I think what Tunaki is asking you to do is to define a property in your settings.xml, e.g.
<settings ...
<profile>
...
<properties>
<xyz>{wGpHaPO3nJ4HSKJa7qcMK9qjHAdwlvMrtjYjj8bwguI=}</xyz>
</properties>
<profile>
</setting>
Then use this property from your settings in your POM:
<configuration>
...
<password>${xyz}</password>
</configuration>
But the tool reading this configuration has to be capable to decrypt the password.
Even better would be to store the encrypted password with a server configuration in your settings.xml like this:
<settings ...
...
<servers>
...
<server>
<id>xyz</id>
<username>manager</username>
<password>{wGpHaPO3nJ4HSKJa7qcMK9qjHAdwlvMrtjYjj8bwguI=}</password>
</server>
...
</servers>
...
</setting>
But again, the consumer of your configuration information has to be capable of reading server configurations. There is an example for the Maven Deploy Plugin at https://maven.apache.org/guides/mini/guide-encryption.html (e.g. -DrepositoryId=xyz).
The referenced question lists the SqlExecMojo as an example on how plugins decrypt passwords.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments