Hello Svere,

It seems that we have some work to make withMaven(){} more friendly to 
Windows+Cygwin users.

We have already tracked:

   - JENKINS-44089 Request that withMaven pipeline step produce both mvn 
   and mvn.cmd wrappers on Windows 
   <https://issues.jenkins-ci.org/browse/JENKINS-44089>
   - JENKINS-44276 Maven fails in pipeline + cygwin 
   <https://issues.jenkins-ci.org/browse/JENKINS-44276>
   
Some refactoring of the code will be needed to generate both standard 
Windows and Cygwin friendly scripts on Windows agents.

Please feel free to give us hints on what a smooth integration with Windows 
and Cygwin should look like.

Cyrille

On Monday, September 11, 2017 at 9:08:53 AM UTC+2, Baptiste Mathus wrote:
>
> Hello,
> I know the developers of that plugin would like to make it as good as 
> possible. To that, if so, could you please try and summarize what you think 
> could be made easier/better? And even if possibly a config error, if you 
> think the error could help more quickly understand what is wrong?
>
> Thanks!
>
> Le 11 sept. 2017 09:03, "Sverre Moe" <sverr...@gmail.com <javascript:>> a 
> écrit :
>
>> The fix was to set the Windows slave Remote Root Directory to Windows URI
>> C:\cygwin64\home\username
>>
>> mandag 11. september 2017 08.35.29 UTC+2 skrev Sverre Moe følgende:
>>>
>>> Well, adding a new JDK in Jenkins Tools pointing to the Windows path of 
>>> Java worked
>>> Then withMaven(jdk: "jdk1.8-win")
>>>
>>> I have though hit another snag. Lots of ERROR after build success.
>>> ERROR: [withMaven] WARNING: Exception archiving and fingerprinting 
>>> MavenArtifact{no.spacetec:myApp:jar:1.0.0-SNAPSHOT 
>>> C:\home\username\workspace\myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ\target\myApp-1.0.0-SNAPSHOT.jar},
>>>  
>>> skip archiving of the artifacts
>>>
>>> ERROR: [withMaven] WARNING: Exception archiving and fingerprinting 
>>> MavenArtifact{no.spacetec:myApp:rpm:1.0.0-SNAPSHOT 
>>> C:\home\username\workspace\myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ\target\rpm\myApp-windows-installer\RPMS\noarch\myApp-windows-installer-1.0.0-SNAPSHOT20170911082120.noarch.rpm},
>>>  
>>> skip archiving of the artifacts
>>>
>>> ERROR: [withMaven] WARNING Exception executing Maven reporter 'Junit 
>>> Publisher' / 
>>> org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher. Please 
>>> report a bug associated for the component 'pipeline-maven-plugin' at 
>>> https://issues.jenkins-ci.org 
>>> java.lang.IllegalArgumentException: Cannot relativize 
>>> 'C:\home\username\workspace\myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ\target/surefire-reports'
>>>  
>>> relatively to 
>>> '/home/username/workspace/myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ'
>>> at 
>>> org.jenkinsci.plugins.pipeline.maven.util.XmlUtils.getPathInWorkspace(XmlUtils.java:226)
>>> at 
>>> org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.executeReporter(JunitTestsPublisher.java:234)
>>> at 
>>> org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher.process(JunitTestsPublisher.java:181)
>>> at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.pr
>>> ocessMavenSpyLogs(MavenSpyLogProcessor.java:109)
>>> at 
>>> org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution$Callback.finished(WithMavenStepExecution.java:864)
>>> at 
>>> org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:362)
>>> at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73)
>>> at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:165)
>>> at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:162)
>>> at org.codehaus.groovy.runtime.Gr
>>> oovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
>>> at org.codehaus.groovy.runtime.Gr
>>> oovyCategorySupport.use(GroovyCategorySupport.java:261)
>>> at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:162)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:35)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:32)
>>> at 
>>> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:32)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
>>> 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:1142)
>>> at 
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>> at java.lang.Thread.run(Thread.java:745)
>>>
>>> ERROR: [withMaven] WARNING Exception executing Maven reporter 'Open Task 
>>> Scanner Publisher' / 
>>> org.jenkinsci.plugins.pipeline.maven.publishers.TasksScannerPublisher. 
>>> Please report a bug associated for the component 'pipeline-maven-plugin' at 
>>> https://issues.jenkins-ci.org 
>>>
>>> It would seem it is unable to use the "correct" home directory as 
>>> Windows is using Cygwin.
>>>
>>>
>>> mandag 11. september 2017 08.18.38 UTC+2 skrev Sverre Moe følgende:
>>>>
>>>> I took a look at the Maven Pipeline documentation again.
>>>> For Windows it says to use bat, not sh. I tried that, and got a little 
>>>> bit closer, but now it cannot find JAVA_HOME
>>>>
>>>> ----- withMaven Wrapper script -----
>>>>
>>>> Error: JAVA_HOME is set to an invalid directory. 
>>>> JAVA_HOME = "/usr/java/jdk1.8.0_102" 
>>>> Please set the JAVA_HOME variable in your environment to match the 
>>>> location of your Java installation. 
>>>>
>>>>
>>>> Jenkins have jdk set at /usr/java/jdk1.8.0_102 and I have created a 
>>>> symlink in my Cygwin
>>>> jdk1.8.0_102 -> /cygdrive/c/Program Files/Java/jdk1.8.0_121
>>>> Windows environment variable JAVA_HOME is set to C:\Program 
>>>> Files\Java\jdk1.8.0_121
>>>>
>>>> mandag 11. september 2017 08.07.21 UTC+2 skrev Sverre Moe følgende:
>>>>>
>>>>> I have connected a Windows slave to Jenkins with SSH+Cygwin.
>>>>> So running shell scripts like "sh 'mvn'" should work as I do it 
>>>>> locally on the Windows.
>>>>>
>>>>> Running withMaven fails, and I cannot figure our why.
>>>>>
>>>>> [Pipeline] node
>>>>> Running on master-windows-x86_64 in 
>>>>> /home/username/workspace/myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ
>>>>> [Pipeline] {
>>>>> [Pipeline] stage
>>>>> [Pipeline] { (Checkout-Windows)
>>>>> [Pipeline] checkout
>>>>>  > git rev-parse --is-inside-work-tree # timeout=10
>>>>> Fetching changes from the remote Git repository
>>>>>  > git config remote.origin.url ssh://
>>>>> g...@git.company.com/software/myApp.git # timeout=10
>>>>> Fetching without tags
>>>>> Fetching upstream changes from ssh://
>>>>> g...@git.company.com/software/myApp.git
>>>>>  > git --version # timeout=10
>>>>>  > git fetch --no-tags --progress ssh://
>>>>> g...@git.company.com/software/myApp.git 
>>>>> +refs/heads/*:refs/remotes/origin/*
>>>>> Checking out Revision 05cf171deb903a01b5880c30de28d4b1865e3ed5 
>>>>> (username/work)
>>>>> Commit message: "Test Windows build on Jenkins"
>>>>>  > git config core.sparsecheckout # timeout=10
>>>>>  > git checkout -f 05cf171deb903a01b5880c30de28d4b1865e3ed5
>>>>>  > git rev-list f9db8914f5688ca74e571dd1104c279f207bf435 # timeout=10
>>>>> [Pipeline] }
>>>>> [Pipeline] // stage
>>>>> [Pipeline] stage
>>>>> [Pipeline] { (Build-Windows)
>>>>> [Pipeline] withMaven
>>>>> [withMaven] Options: []
>>>>> [withMaven] Available options: 
>>>>> [withMaven] use JDK installation jdk1.8
>>>>> $ where mvn.cmd
>>>>> [withMaven] use Maven installation provided by the build agent with 
>>>>> executable 
>>>>> C:\Users\username.POLAR\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin\mvn.cmd
>>>>> [Pipeline] {
>>>>> [Pipeline] sh
>>>>> [myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ]
>>>>>  
>>>>> Running shell script
>>>>> sh: 
>>>>> /home/username/workspace/myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ@tmp/durable-ff9c24b3/pid:
>>>>>  
>>>>> No such file or directory
>>>>> sh: 
>>>>> /home/username/workspace/myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ@tmp/durable-ff9c24b3/jenkins-log.txt:
>>>>>  
>>>>> No such file or directory
>>>>> sh: 
>>>>> /home/username/workspace/myApp_username_work-3U54DPE57F6TMOZM2O6QBWDQ2LNRU2QHAXT6INC3UPGWF2ERMXAQ@tmp/durable-ff9c24b3/jenkins-result.txt:
>>>>>  
>>>>> No such file or directory
>>>>>
>>>>>
>>>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/5da9746b-17c9-47b7-ab1e-88f32b0416f2%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/5da9746b-17c9-47b7-ab1e-88f32b0416f2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ed70a784-f45a-4820-b53d-b176e8135c1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to