In my case since the command was failing because the method key was missing or wrong. According to the man page of xcodebuild this is the list of allowed methods:
app-store, validation, ad-hoc, package, enterprise, development, developer-id, and mac-application
Note that the default value is "development". If you don't specify a method or you specify "developer-id", then you need to provide also a valid teamID key which is reported in the CN of the certificate provided by Apple which is used to sign the application (the teamID is a alphanumeric string at the end of the CN field).
In our case the Apple certificate was only installed in the build machine and no developer could have it installed on the personal computer or VM. So in order to test the package creation and signature we created a self-signed certificate using the steps reported here. Anyway since the teamID was not present in our certificate we had to set the method to "mac-application". In this case xcodebuild was not complaining and the package was generated correctly.
Our plist file was something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>teamID</key>
<string>F4keTeamID0</string>
<key>compileBitcode</key>
<true/>
<key>method</key>
<string>mac-application</string>
</dict>
</plist>