-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.226
The declarative pipeline offers the withAnt build step. Unfortunately this only sets up the Ant environment and then uses a shell (bat / sh) to execute Ant within that environment.
While the work-around as documented on https://plugins.jenkins.io/ant/ works:
withAnt(installation: 'myinstall') { dir("scoring") { if (isUnix()) { sh "ant mytarget" } else { bat "ant mytarget" } }
Needing to detect the operating system for a tool that works on all operating systems is plain clunky and immediately raises the difficulty bar when migrating from freestyle jobs. Freestyle jobs allow you to simply use Ant without you having to worry about which operating system is being used.