jenkins the definitive guide

(Jeff_L) #1

Figure 12.11. Deploying an artifact from a Maven repository


The rest of this build job simply checks out the deployment project and invokes the mvn package goal,
and then deploys the WAR file using the Deploy plugin (see Figure 12.12, “Preparing the WAR to be
deployed”). The target.version property will be automatically passed into the build job and used
to deploy the correct version.


Figure 12.12. Preparing the WAR to be deployed


Similar techniques can be used for other project types. If you are deploying to an application server that
is not supported by the Deploy plugin, you also have the option of writing a custom script in whatever
language is most convenient, and getting Jenkins to pass the requested version number as a parameter
as described above.


12.3.2. Deploying Scripting-based Applications Like Ruby and PHP


Deploying projects using scripting languages such as PHP and Ruby is generally simpler than deploying
Java applications, though the issues related to database updates are similar. Indeed, very often these
deployments essentially involve copying files onto a remote server. To obtain the files in the first place,
you have the choice of either copying them from another build job’s workspace using the Copy Artifacts
option, or checking the source code out directly from the source code repository, if necessary using a

Free download pdf