Ant Task "Target" field too short, how can i pass more variables?

I am using capability variables to set various paths and executables used during build process.
The reason for that is, these paths and executables can be different (different paths) on each agent, and using capabilities seemed to be a convenient way.

The problem is that the Ant Task "Target" field is rather limited in character length and its content gets clipped, so i am unable to pass all needed variables to Ant.

Is there other way of passing Bamboo variables to Ant?

2 answers

1 accepted

0 votes
Answer accepted

There is a task plugin "Marvelution Bamboo Variables Stamper".
It saves Bamboo variables into a file, so they can be used by other tasks.

Using the following tecnique may help:

ant deploy

... and in your ant ...

<property file="${}"/>

You mean to put "ant deploy" into the Ant Task "target" field?

Thats exactly what i am doing and it doesnt work, because the "target" field has limited length, so i cannot put ALL needed variables into it - the resulting string is just too long and gets clipped.

So i am asking if there is some other way to pass Bamboo variables to Ant

Thank you, this will of course work, but if i would have to use propfiles, then i would just place appropriate propfile on each agent and be done with it.

Isn't there any other way, without the need of having propfiles with predetermined content?
I like the idea of using variables, which can be set differently for each agent, and the setting can be done via Bamboo administration instead of editing files on each agent.

You do not need to use prop files. You can modify it to directly set up properties using conditional targets, for instance. Or use the to create the <if>

I still dont get it, so let me rephrase my question:

Let's say i have capability variable "Bamboo.capability.something" containing "b:\somepath\somewhere\something".
How do i pass this variable value to Ant, without adding " -Dsomething=${bamboo.capability.something}" in the Ant Task target field ?

Sorry, I do not know other way to pass it.

I keep all my agents config files in SVN and provided reasonable defaults to properties as well, in the manner I shown you. In this way:

1/ You have a versioned props file for each agent (and that's good, IMHO)

2/ Disadvantage is of course that creating the build is not the only thing you must do, you must craete the properties file as well

BUT: you can alleviate it. Example: instead of passing full paths ("b:\somepath\somewhere\something", "b:\somepath\somewhere\somethingelse"), you pass only the root ("b:\somepath\somewhere") and deduct them, etc.

I understand what you want, but I do not know any other way to do it.

Thank you very much, it looks like i want something thats not possible.
I am thinking about maybe writing a task plugin to export the variables into a file, which could be then imported.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: More details: https://co...

43 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you