开发者

How can I supply Maven release prepare information without prompts?

开发者 https://www.devze.com 2022-12-30 20:33 出处:网络
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

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:prepar开发者_运维知识库e plugin:goal?

Thanks.


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.


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


If it is a Perl solution you seek, command-line arguments are usually executed through the system command.

Try system $cmd;

As far as I can tell, there's no need to open and close filehandles.


You can specify everything using arguments to the mvn release:prepare command:

mvn release:prepare -DautoVersionSubmodules=true -DreleaseVersion={your release version} -DdevelopmentVersion={next version}-SNAPSHOT -Dtag={your tag}

0

精彩评论

暂无评论...
验证码 换一张
取 消