Job Runner is parsing the commanline and incorrect adding quotes?

I have a job which uses the nant job runner. I tried this with the batch runner as wel and got the same results.

Some of the properties I'm passing in to nant have spaces ( filepaths ). I quote the values but for some reason it's inserting extra quotes.

This is the cmdline:

-D:source.base.dir="%system.source.base.dir%" -D:target.base.dir="%system.target.base.dir%" -D:project.build.filters="%system.project.build.filters%"

the system variable target.base.dir is defined like so: \\gcm-td4\c$\Program Files\GRAS Service Test

Looks like TeamCity is parsing my cmdline and sticking in arbitrary quotes which screws up the value for target.base.dir for nant. Here's what actually get's executed:

Starting: C:\TeamCity\buildAgent\work\82146f8c47cda3a7\nant\bin\NAnt.exe -buildfile:C:\TeamCity\buildAgent\work\82146f8c47cda3a7\build\service.deploy.build -extension:C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NAntLoggers.dll -listener:JetBrains.BuildServer.NAntLoggers.NAntListener -D:source.base.dir="C:\TeamCity\buildAgent\work\82146f8c47cda3a7\deploy" "-D:target.base.dir="\\gcm-td4\c$\Program Files\GRAS Service Test"" -D:project.build.filters="C:\TeamCity\buildAgent\work\82146f8c47cda3a7\filters" deploy

This breaks nant. Please advise.

4 comments
Comment actions Permalink

Hello,

There is another better way for supplying NAnt properties for NAnt build runner.
In the build configuration settings please find 'Properties and Environment variables' section of build type configuration you may add a 'system propery'.
TeamCity NAnt build runner translates all system properties to nant properies. In this scenario TeamCity takes care of all parameters quoting issues.

0
Comment actions Permalink

Eugene,

I am using system properties. The value of the system property has spaces. I'm using the NAnt build runner and passing in the system properties. So something is not working correctly becuase this is where I'm getting the extra quotes - in the translation of those system properties.

Dan

0
Comment actions Permalink

Yes.

You have:

-D:source.base.dir="%system.source.base.dir%" -D:target.base.dir="%system.target.base.dir%" -D:project.build.filters="%system.project.build.filters%"

You may convert it to the number of system properties and this remove all -D commandline parameters.
As you have same system properties added you may simple remove -D parameters from custom commandline at all.

As far as I see you already have most of those properties added as system properties.

BTW. to tell the truth, -D:aaa="fff qqq" is not the right way to quote in termas of OS, please consider using "-D:aaa=fff qqq"

0
Comment actions Permalink

Eugene,

Sorry, I ddin't realize that's how it worked. I thought you had to explicity pass in those parameters on the command line. I'm more used to the batch command runner. That's a really nice feature.

I took out all the extra parameters and left them defined as system properites and now everything works as expected, spaces and all.

Thanks for the tip.

Dan

0

Please sign in to leave a comment.