问题描述
如documentation中所述:
- 添加到 pom.xml(并执行 Maven 重新加载)
<plugin> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-maven-plugin</artifactId> <version>3.0.3</version> </plugin>
- 为了尝试一下,我用这个插件运行 Maven 来获取一个加密值:
mvn jasypt:encrypt-value -Djasypt.encryptor.password="the password" -Djasypt.plugin.value="theValueYouWantToEncrypt"
但我得到以下[ERROR]
:
[ERROR] UnkNown lifecycle phase ".encryptor.password=the password". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>
我认为插件安装正确,因为即使我的 IDE 也能识别它:
有什么想法吗?
解决方法
这个命令行对我有用。
mvn jasypt:encrypt-value "-Djasypt.encryptor.password=password" "-Djasypt.plugin.value=test"
痕迹
[INFO] Active Profiles: Default
[INFO] Encrypting value test
[INFO] String Encryptor custom Bean not found with name 'jasyptStringEncryptor'. Initializing Default String Encryptor
[INFO] Encryptor config not found for property jasypt.encryptor.algorithm,using default value: PBEWITHHMACSHA512ANDAES_256
[INFO] Encryptor config not found for property jasypt.encryptor.key-obtention-iterations,using default value: 1000
[INFO] Encryptor config not found for property jasypt.encryptor.pool-size,using default value: 1
[INFO] Encryptor config not found for property jasypt.encryptor.provider-name,using default value: null
[INFO] Encryptor config not found for property jasypt.encryptor.provider-class-name,using default value: null
[INFO] Encryptor config not found for property jasypt.encryptor.salt-generator-classname,using default value: org.jasypt.salt.RandomSaltGenerator
[INFO] Encryptor config not found for property jasypt.encryptor.iv-generator-classname,using default value: org.jasypt.iv.RandomIvGenerator
[INFO] Encryptor config not found for property jasypt.encryptor.string-output-type,using default value: base64
[INFO]
ENC(5P+yq0XlMiew9438IxsILCXs/2nGH2C4eq3IYamXoDeVeYdzoJLhLZPBMpGC4kMA)