'Perforce password (P4PASSWD) invalid or unset

I have this block in the Cruisecontrol.net xml file:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
    <project name="MyProject">
        <artifactDirectory>C:\Program Files (x86)\CruiseControl.NET\Mydashboard</artifactDirectory>

            <sourcecontrol type="p4">
                <view>//Myprojectfolder/Code/...</view>
                <executable>c:\Program Files\Perforce\p4.exe</executable>
                <client>Myworkspace</client>
                <user>John</user>
                <applyLabel>false</applyLabel>

                <port>PERFORCEPR123:10080</port>
                <autoGetSource>true</autoGetSource>
            </sourcecontrol>
            <tasks>

                <msbuild>
                    <executable>C:\WINDOWS\Microsoft.NET\Framework64\v3.5\MSBuild.exe</executable>
                    <workingDirectory>D:\Workspace\Myworkspace\Code\src</workingDirectory>
                    <projectFile>Myproject.sln</projectFile>
                    <targets>Build</targets>
                    <timeout>1000000</timeout>
                    <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
                    <buildArgs>/v:minimal /noconlog /p:Configuration=Release</buildArgs>
                </msbuild>

            </tasks>

            <publishers>

                <xmllogger logDir="C:\Program Files (x86)\CruiseControl.NET\Mydashboard\Buildlogs" />
                    <buildpublisher>
                        <sourceDir>D:\Workspace\Myworkspace\Code\src\newsrc\Webapplication.site</sourceDir>
                        <publishDir>D:\deployment\Webapplication.site</publishDir>
                        <useLabelSubDirectory>false</useLabelSubDirectory>
                        <alwaysPublish>false</alwaysPublish>
                    </buildpublisher>
            </publishers>
        </project>
</cruisecontrol>

But,when i build my project i am getting the below error:

BUILD EXCEPTION
Error Message:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Perforce GetModifications failed: c:\Program Files\Perforce\p4.exe -s -c Myworkspace -p PERFORCEPR123:10080 -u John -P john123 changes -s submitted //Myprojectfolder/Code/......@2014/01/15:08:13:20,@2014/01/15:08:14:20
Error output from process was:
error: Perforce password (P4PASSWD) invalid or unset.
exit: 1

   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Perforce.P4.Execute(ProcessInfo process, String description)
   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Perforce.P4.GetModifications(IIntegrationResult from, IIntegrationResult to)
   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.QuietPeriod.GetModificationsWithLogging(ISourceControl sc, IIntegrationResult from, IIntegrationResult to)
   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.QuietPeriod.GetModifications(ISourceControl sourceControl, IIntegrationResult lastBuild, IIntegrationResult thisBuild)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.GetModifications(IIntegrationResult from, IIntegrationResult to)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)

Is there a workaround for this?

Thanks



Solution 1:[1]

I suspect CC is just using the Perforce command line client. To workaround this I would:

1) Add a group to Perforce and set the Timeout to unlimited. 2) Add the user running the CC task to the Perforce group 3) From the build machine run 'p4 -u login'

This will store a local ticket that lasts forever to authenticate the user. If you need a an account to run tools like CC under, fill out this form and Perforce will give you a free background user:

http://www.perforce.com/support-services/request-background-user

Solution 2:[2]

If you have a bad ticket file, you will get this error. Delete the ticket file, then run your tool or run p4 login to recreate the ticket.

*nix location: ~/.p4tickets

Windows location: C:\Documents and Settings\\p4tickets.txt

Bug Reference

p4 login reference

Solution 3:[3]

Below worked for me.

  1. Set env variable P4PASSWD enter image description here

  2. Open new cmd prompt,

p4 login enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Denise Skidmore
Solution 3 Vaibs