Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I supply Maven release prepare information without prompts?

I want to automate the execution of Maven release:prepare with Perl so that the user doesn't have to answer the prompts for version names etc. Are there a -D arguments that can be supplied so that no prompting is done? I tried the obvious solution which is to feed the prompt answers to mvn via perl code like this:

my $cmd = qq(mvn release:prepare -DautoVersionSubmodules=true-DpreparationGoals="clean install"); 
open MVN, "| $cmd";

print MVN "\n"; # default
print MVN "$cur_version";
print MVN "\n";
print MVN "$next_version";
print MVN "\n";

close MVN;

but mvn ignores such input and winds up using the defaults (and doesn't prompt either).

So, are there -D args for the release:prepare plugin:goal?

Thanks.

like image 437
Bruce Settergren Avatar asked May 20 '10 16:05

Bruce Settergren


2 Answers

You can use the following maven command to do that...

mvn --batch-mode release:prepare

This will assume defaults for anything that you would normally be prompted for; it would be like running a release and simply hitting enter every time it asked you a question. For instance, if your current development version of your project was 1.2.3-SNAPSHOT, it would release version 1.2.3 and move your development version up to 1.2.4-SNAPSHOT. It is usually best to let Maven work this things out for you anyway since the goal of maven is to use convention over configuration. However, is you need to specify non-default properties, the maven-release-plugin allow command line property override as well as using a 'release.properties' file for overriding these settings.

like image 152
Jesse Webb Avatar answered Oct 13 '22 11:10

Jesse Webb


For the Maven part, see Performing a Non-interactive Release.

like image 37
Pascal Thivent Avatar answered Oct 13 '22 12:10

Pascal Thivent