Deployment to Pivotal Web Services from TeamCity

I have tried to use a build on TeamCity server that uses the pivotal maven plugin to push the build to pivotal web services using cf:push, but this fails with an authentication issue as follows:

WARNING: POST request for "" resulted in 401 (Unauthorized); invoking error handler

I have attempted to setup the appropriate properties for the cf.login and cf.password as configuration parameters.


Can anyone tell me if deployment to pivotal web services is supported and if so how I would authenticate

many thanks



Comment actions Permalink

Hello Grant,

How do you run the build in TeamCity? What runner is used? 
Please try to run the same build via command line on TeamCity agent machine in the checkout directory and under the same user that the agent i running under. For more details see the section. Does the build run successfully?

Comment actions Permalink

Hi Alina

Thanks for your comment, I am running with the default build agent, so I have done what you suggested and run the build command under the work directory for the build agent and it works fine. The arguments I have to provide to maven include the user name and password of the form

mvn package  cf:push cf:login -Dcf.username=username -Dcf.password='password'

So I guess I am not passing those arguments down from the build configuration to the build agent correctly


Comment actions Permalink


If the build succeeds from the console but fails in TeamCity, please try to use a command line runner in TeamCity to launch the same command as in the console. If it still behaves differently in TeamCity, most probably this is an environment or a tool issue.

If the command line runner works but the dedicated runner does not while the options are all the same, please create a new issue in our tracker detailing the case. Please attach all the build step settings, the build log, all agent logs covering the build, the command you used in the console to run the build and the full console output of the build.


Please sign in to leave a comment.