Search code examples
javamavenspring-bootmaven-release-pluginjasypt

Not able to do maven release with jasypt encryption


I've a Springboot project handled by maven that contains some secrets encrypted with Jasypt. When I'm running the mvn deploy I'm passing the jasypt password as:

mvn -B clean deploy -Djasypt.encryptor.password=${jasypt_password}

And it is able to run test cases and deploy the jar file to repository. But when I'm doing the same with mvn release the jasypt password is not properly set.

mvn -B clean release:prepare release:perform -Djasypt.encryptor.password=${jasypt_password}

Or

mvn -B release:prepare -Djasypt.encryptor.password=${jasypt_password}

For both these cases, I'm getting following error while running the test cases.

Caused by: java.lang.IllegalStateException: Required Encryption configuration property missing: jasypt.encryptor.password

The plugin configuration I'm using is:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
            <localCheckout>true</localCheckout>
        </configuration>
</plugin>

How should I set jasypt password while running the maven release?


Solution

  • I got the issue solved using following command. Apparently maven release plugin takes configuration parameters in a different way.

    mvn -B clean release:prepare release:perform -Darguments="-Djasypt.encryptor.password=${jasypt_password}"