Don't add config files and generated files to version control.
How do I run the task "ant config_prod" just after checking out the code and running a build ?
A Jenkins task can have multiple build steps, so this is easy:
- Step 1:
ant config_prod
- Step 2:
ant
(to run the default Ant task, or elseant whatever_your_build_task_is
)
how to deliver Prod and Staging builds ?
You have several options.
Use a single Jenkins task to deliver everything, with many build steps, for example:
ant config_dev
ant build_dev
ant deploy_dev
ant config_staging
ant build_staging
ant deploy_staging
- ...
Use separate Jenkins tasks for each env. You have at least two options:
Each Jenkins task has its independent workspace (the default). This is a bit wasteful, because each will need a clean checkout of the source code. On the upside, each task will be independent, so they can run in parallel if needed.
All Jenkins tasks share their workspace: you override the default config to specify a workspace, and you specify the same for all. This will save disk space, but you'll have to be careful to avoid running them in parallel, as you can get broken builds or worse.