How to set variables at build time

asked 13 Sep '11, 08:05

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%


Sometimes it is convenient to set project variables at build time. There are a couple of ways that this can be accomplished:

Use the preBuildActionList:

  <preBuildActionList>
    <setInstallerVariable name="version" value="${env(BUILDVER)}" />
  </preBuildActionList>

Or, starting with 5.4.6, it is possible to pass variables directly in the command line to the builder $ builder build project.xml --setvars version=1.2.3 project.shortName=newShortName project.fullName="New Installer Name"

If you want the value to be available at runtime, when the installer is run in the user machine, then you need to create a parameter that will store the value of the variable. These parameters are usually 'hidden' so they do not get displayed to the end user:

<parameterList>
   <stringParameter name="mysql_port" ask="0" />
</parameterList>

$ builder build project.xml --setvars mysql_port=3306

link

answered 13 Sep '11, 08:07

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×27
×18
×8

Asked: 13 Sep '11, 08:05

Seen: 2,041 times

Last updated: 13 Sep '11, 08:07