Search code examples
eclipsemavenm2e

Eclipse run mvn with command parameter (e.g. --encrypt-master-password)


I never had to do this before but maybe someone else has.

I want to run "mvn --encrypt-master-password".

I'm on a machine with only Eclipse and m2e. I could of course download and set up maven on my hard drive with the appropriate JAVA_HOME envvars etc, but I figured I'd try to get it done quickly in Eclipse.

m2e quickly gives a "no goals have been specified" error.

I could put in a dummy goal but I can't see any way to enter a mvn command line parameter (as opposed to a 'goal parameter')

This is theoretical now since I'll go and do this on a command line somewhere, but I'd like to know if it's possible.


Solution

  • For a one-time password encryption job you can set --encrypt-master-password <your password> as a goal in the Maven build as already specified by flafoux (Run Configurations > Maven Build > New build > ...).

    But this is not secure since you password is stored in a configuration (unless you delete it right after the execution). And this is also not handy since you need to update a job manually for every encrypted password you need...

    ps: https://maven.apache.org/guides/mini/guide-encryption.html says since 3.2.1 Maven should ask for the password if not specified, but it does not at least at my eclipse lune having Maven 3.2.1 embedded - may be it does at more recent verions.