Search code examples
javamavenjasypt

Jasypt Maven plugin: "Unknown lifecycle phase"


As described in the documentation:

  1. Add to pom.xml (and perform Maven reload)
    <plugin>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-maven-plugin</artifactId>
        <version>3.0.3</version>
    </plugin>
    
  2. To try it out, I run Maven with this plugin to get a single encrypted value:
    mvn jasypt:encrypt-value -Djasypt.encryptor.password="the password" -Djasypt.plugin.value="theValueYouWantToEncrypt"
    

But I get the following [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>

I presume the plugin installed correctly as even my IDE recognises it: enter image description here

Any ideas?


Solution

  • This command line worked for me.

    mvn jasypt:encrypt-value "-Djasypt.encryptor.password=password" "-Djasypt.plugin.value=test"
    

    The trace

    [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)