[SalesForce] Deploy custom labels with Ant

We are trying to start using custom labels, but are having issues deploying them using our ant script.

Our custom labels file looks something like this:

<?xml version="1.0" encoding="UTF-8"?> 
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
     <labels>
         <fullName>Inspection_Name</fullName>
         <language>en_US</language>
         <protected>true</protected>
         <shortDescription>Inspection Name</shortDescription>
         <value>Inspection</value>
     </labels>
</CustomLabels>

In the package.xml we have added this:

<types>
    <members>*</members>
    <name>CustomLabels</name>
</types>

We are getting the following error when deploying:

Error: labels/CustomLabels.labels(Inspection_Name):Not in package.xml

Ant command (variables come from a properties file):

<sf:deploy 
   username="${sf.username}" 
   password="${sf.password}${sf.token}" 
   serverurl="https://login.salesforce.com" 
   deployRoot="${target.dir}" 
   maxPoll="500" 
   pollWaitMillis="20000"
   runAllTests="true" 
   logType="Debugonly" 
/>

The package.xml and migration toolkit are both at API 27.0. What are we missing?

Best Answer

I got the same error and tried the code below. It worked. The metadata type is CustomLabel not CustomLabels. It's very strange.

<types>
    <members>*</members>
    <name>CustomLabel</name>
</types>

Reference:
Salesforce Metadata Types