A workspace mapping containing a variable reference (example and log output below) will fail to poll for changes due to the variable not getting resolved. Manually running the build will properly resolve the variable and update the workspace view. However, when a poll is executed, the workspace view is replaced with the raw template that does not have the variable's value inserted.
The variable is defined using the standard Jenkins environment variable plugin.
Example:
//tools/sun/jdk1.8.0_45/${JAVA_PLATFORM}/... //CLIENT_NAME/tools/${JAVA_PLATFORM}/...
Poll Log:
Started on Jul 22, 2015 3:27:00 PM Looking for changes... Using master Read ClientSpec from: //x/java/JRX/trunk/p4client.functest.view Using master perforce client: jenkins-rxa-x64-trunk-install-windows-8-64 Read ClientSpec from: //x/java/JRX/trunk/p4client.functest.view Warning: Client Spec line invalid, ignoring. (View:) Latest submitted change selected by workspace is 889214 ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@37d2f[rxa-x64-trunk-install-windows-8-64] java.util.regex.PatternSyntaxException: Illegal repetition near index 44 //x/java/JRX/trunk/testFunc/xinstall/tools/\${JAVA_PLATFORM}/(.*) ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.closure(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.<init>(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at hudson.plugins.perforce.PerforceSCMHelper.getTokenPattern(PerforceSCMHelper.java:218) at hudson.plugins.perforce.PerforceSCMHelper.doesPathMatchView(PerforceSCMHelper.java:198) at hudson.plugins.perforce.PerforceSCMHelper.mapToWorkspace(PerforceSCMHelper.java:184) at com.tek42.perforce.parse.Changes.getWorkspacePathForFile(Changes.java:98) at com.tek42.perforce.parse.Changes.calculateWorkspacePaths(Changes.java:92) at com.tek42.perforce.parse.Changes.getChangelist(Changes.java:74) at hudson.plugins.perforce.PerforceSCM.getCurrentDepotRevisionState(PerforceSCM.java:1354) at hudson.plugins.perforce.PerforceSCM.compareRemoteRevisionWith(PerforceSCM.java:1234) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:357) at hudson.scm.SCM.poll(SCM.java:374) at hudson.model.AbstractProject._poll(AbstractProject.java:1427) at hudson.model.AbstractProject.poll(AbstractProject.java:1330) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:466) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:495) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)