tags:

views:

612

answers:

1

I would like to import a build product to Subversion in a NAnt build task. But it fails for me.

The following works fine for me from the command-line:

svn.exe import -m 'Importing build 14' build/project.zip http://svn/builds/14/project.zip --username builder --password secret

In NAnt I have the following task:

<exec program="svn.exe" commandline="import -m 'Importing build 14' build/project.zip http://svn/builds/14/project.zip --username builder --password secret" />

But executing a NAnt target with this task yields the error message: "Too many arguments to import command".

Have you any idea why I get this error message in NAnt, and not when run from the command-line?

+2  A: 

Seems like it might be having trouble escaping the quotes. If values to attributes contain quotes, generally these should be escaped (deals with special characters and xml parsing).

This should do the trick:

<exec program="svn.exe" commandline="import -m &quot;Importing build 14&quot; build/project.zip http://svn/builds/14/project.zip --username builder --password secret"/>

To learn more about the XML and what needs to be escaped you can reference this article as it discusses it. It also shows you other escape codes if you need it.

Scott Saad
Indeed! Thanks for the answer. And thanks for the explanation and the link.
Ole Lynge