Skip to content

[JENKINS-52369] Specifying -file PATH under Targets for "Invoke Ant" causes working directory to be set incorrectly #319

@jenkins-infra-bot

Description

@jenkins-infra-bot

When specifying a path to a build file under "Build File" (ie BuildFolder/build.xml), the Ant plugin will change the working directory to "BuildFolder" and run ant with the argument "-file build.xml". However when manually specifying -file BuilderFolder/build.xml under "Targets", the Ant plugin will STILL change the working directory, but this time not modify the -file path. 

This causes Ant to fail.

I would expect that when leaving "Build File" blank, it would use the root directory of the Jenkins workspace. 

 

The bug can be easily observed by replacing the ant binary with this simple shell script that prints the supplied arguments as well as the current working directory

#!/bin/sh
echo ${@}
pwd
 

I have attached screenshot of Jenkins configuration + output 

 

 

This bug is observed on Jenkins 2.130 with Ant plugin version 1.8  (but it seems like this issue is not new, as it is also seen on Jenkins 1.595 with Ant plugin version 1.2


Originally reported by smikkelsen, imported from: Specifying -file PATH under Targets for "Invoke Ant" causes working directory to be set incorrectly
  • assignee: armfergom
  • status: Open
  • priority: Minor
  • component(s): ant-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251216-182730
Raw content of original issue

When specifying a path to a build file under "Build File" (ie BuildFolder/build.xml), the Ant plugin will change the working directory to "BuildFolder" and run ant with the argument "-file build.xml". However when manually specifying -file BuilderFolder/build.xml under "Targets", the Ant plugin will STILL change the working directory, but this time not modify the -file path. 

This causes Ant to fail.

I would expect that when leaving "Build File" blank, it would use the root directory of the Jenkins workspace. 

 

The bug can be easily observed by replacing the ant binary with this simple shell script that prints the supplied arguments as well as the current working directory

#!/bin/sh
echo ${@}
pwd
 

I have attached screenshot of Jenkins configuration + output 

 

 

This bug is observed on Jenkins 2.130 with Ant plugin version 1.8  (but it seems like this issue is not new, as it is also seen on Jenkins 1.595 with Ant plugin version 1.2

3 attachments

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions