-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins 2.89.4
Pipeline Maven Plugin 3.3.2
Consider the following pipeline for a project named maven-invoker-test-relative
node { stage("Build") { withMaven(options: [ invokerPublisher() ]) { bat 'mvn clean verify -Dmaven.test.failure.ignore=true' } } }
with the attached project put in a directory maven-invoker-test-relative inside the Jenkins workspace. The Invoker Publisher fails with:
ERROR: [withMaven] WARNING Exception executing Maven reporter 'Invoker Publisher' / org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher. Please report a bug associated for the component 'pipeline-maven-plugin' at https://issues.jenkins-ci.org java.lang.IllegalArgumentException: Cannot relativize 'src/it/projects' relatively to 'C:\Users\<...>\.jenkins\workspace\maven-invoker-test-relative' at org.jenkinsci.plugins.pipeline.maven.util.XmlUtils.getPathInWorkspace(XmlUtils.java:396) at org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher.expandAndRelativize(InvokerRunsPublisher.java:184) at org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher.executeReporter(InvokerRunsPublisher.java:132) at org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher.process(InvokerRunsPublisher.java:109) at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:118) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution$WithMavenStepExecutionCallBack.finished(WithMavenStepExecution.java:1019) at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114) at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:368) at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:166) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:331) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:82) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 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 java.lang.Thread.run(Thread.java:748)
The culprit is the declaration
<projectsDirectory>src/it/projects</projectsDirectory>
inside the configuration of the Invoker Plugin, which uses a path relative to the POM in order to locate the ITs project directory.
A possible workaround is to change it to:
<projectsDirectory>${basedir}/src/it/projects</projectsDirectory>
but this is not ideal as it requires to change the POM.
Looking into the code, I think this issue would arise for any path relative to the POM.