Advanced usage: Spring profiles, Multi-module, and Asymmetric Encryption
masterUsing Spring Profiles
You can specify an active Spring profile when running plugin goals:
mvn jasypt:encrypt -Dspring.profiles.active=production -Djasypt.encryptor.password="mypassword"Multi-Module Projects
In multi-module projects, use the -N flag to prevent the plugin from recursing into child modules. You must specify the full path to the configuration file:
mvn jasypt:encrypt -Djasypt.plugin.path="file:module/src/main/resources/application.properties" -Djasypt.encryptor.password="mypassword" -NAsymmetric Encryption (PEM format)
To encrypt a value using a public key in PEM format:
mvn jasypt:encrypt-value \
-Dspring.config.location="file:src/main/resources/application.yml" \
-Djasypt.encryptor.public-key-format="PEM" \
-Djasypt.encryptor.public-key-location="file:src/main/resources/publickey.pem" \
-Djasypt.plugin.value="valueToEncrypt"mvn jasypt:encrypt -Dspring.profiles.active=production -Djasypt.encryptor.password="mypassword"