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.processMavenSpyLogs(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.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: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://
>> [email protected]/software/myApp.git # timeout=10
>> Fetching without tags
>> Fetching upstream changes from ssh://
>> [email protected]/software/myApp.git
>>  > git --version # timeout=10
>>  > git fetch --no-tags --progress ssh://
>> [email protected]/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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/cd9eb59b-d6f0-45db-abfb-e1f64b1f7212%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to