If branch is defined as parameter, e.g.
TC_BRANCH=//depot/path1
and then that parameter is used in p4 view mappings, e.g.
${TC_Branch}/... //myworkspace/...
the p4 polling functionality fails with following error:
Error in client specification.
Mapping '/...' is not under '//USER/...'.
P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
Mapping '/...' is not under '//USER/...'.
at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:151)
at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:102)
at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:212)
at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1522)
at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:516)
at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:181)
at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:160)
at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:100)
at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:166)
at org.jenkinsci.plugins.p4.tasks.PollTask.invoke(PollTask.java:50)
at org.jenkinsci.plugins.p4.tasks.PollTask.invoke(PollTask.java:33)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2760)
at hudson.remoting.UserRequest.perform(UserRequest.java:181)
at hudson.remoting.UserRequest.perform(UserRequest.java:52)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at hudson.remoting.Engine$1$1.run(Engine.java:98)
at java.lang.Thread.run(Thread.java:748)
ERROR: P4: Task Exception: Error in client specification.
Mapping '/...' is not under '//USER/...'.
Finished: FAILURE
This funcionality is working fine with old Perforce plugin.
We are using the branches as parameters as we reference this parameter in multiple places within the job, e.g. pass it to another job or use it in jelly.script for branches to be displayed in email