Let Jasypt know that my file is application.yml and not application.properties

510 views Asked by At

With the plugin and dependency of Jasypt, I want to encrypt my email and password:

spring:
  mail:
    host: smtp.gmail.com
    port: 587
    username: DEC([email protected])
    password: DEC(my-password)

When using jasypt:encrypt, I get this error:

[ERROR] Failed to execute goal com.github.ulisesbocchio:jasypt-maven-plugin:3.0.5:encrypt (default-cli) on project Spring_Security: Error Encrypting: Unable to read file src\main\resources\application.properties

In my case, the file application.properties does not exist. Instead, I am using application.yml.

Also, I have tried it this way:

mvn jasypt:encrypt -Djasypt.plugin.path="file:src/main/resources/application.yml" -Djasypt.encryptor.password="the password"

but then I get the error:

[ERROR] No plugin found for prefix '.plugin.path=file' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\rcie.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

1

There are 1 answers

0
Nakip Ali On

After ensure the add to dependency and plugin into your project, please run into your current project directory following commands.

mvn clean install

mvn jasypt:encrypt "-Djasypt.plugin.path=file:src/main/resources/application.yml"

I think the error occured because of double quotation marks position("")