jenkins the definitive guide

(Jeff_L) #1

The final option lets you configure a private Maven repository for this build job. Normally, Maven
will just use the default Maven repository (usually in the .m2/repository folder in the user’s home
directory). Occasionally, this can lead to build jobs interfering with each other, or use inconsistent
snapshot versions from one build to another. To be sure that your build is run in clean laboratory
conditions, you can activate this option. Your build job will get its own private repository, reserved for
its own exclusive use. On the downside, the first time the build job runs a build, this may take some time
to download all of the Maven artifacts, and private repositories can take up a lot of space. However, it
is the best way of guaranteeing that your build is run in a truly isolated environment.


5.6.2. Ant Build Steps


Freestyle build jobs work equally well with Ant. Apache Ant^9 is a widely-used and very well-known
Java build scripting tool. Indeed, a very large number of Java projects out there rely on Ant build scripts.


Ant is not only used as a primary build scripting tool—even if your project uses Maven, you may resort
to calling Ant scripts to do more specific tasks. There are Ant libraries available for many development
tools and low-level tasks, such as using SSH, or working with proprietary application servers.


In its most basic form, configuring an Ant build step very is simple indeed—you just provide the version
of Ant you want to use and the name of the target you want to invoke. In Figure 5.27, “Configuring an
Ant build step”, for example, we are invoking an Ant script to run a JMeter test script.


Figure 5.27. Configuring an Ant build step


As with the Maven build step, the “Advanced...” button provides you with more detailed options, such as
specifying a different build script, or a build script in a different directory (the default will be build.xml
in the root directory). You can also specify properties and JVM options, just as you can for Maven.


5.6.3. Executing a Shell or Windows Batch Command


Occasionally you may need to execute a command directly at the Operating System level. Some legacy
build processes rely on OS-specific scripts, for example. In other cases, you may need to perform a low-
level operation that is most easily done with an OS-level command.


(^9) http://ant.apache.org/

Free download pdf