Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61665

withAnt - automatically use correct shell

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • ant-plugin, pipeline
    • 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.

            Unassigned Unassigned
            smd Stefan Drissen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: