[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2018-08-05 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jesse Glick commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Filed a PR to formally deprecate these steps.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2018-08-05 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jesse Glick commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 My advice remains to avoid these two steps.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2017-03-21 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jesse Glick commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Perhaps some other plugin is also loading maven-core. Probably maven-plugin. I would not recommend importing org.apache.maven.model.* classes; use dynamic typing. Or just avoid the readMavenPom step altogether, and use something like 

 

def version = sh script: '''
mvn help:evaluate -Dexpression=project.version | perl -n -e 'print $1 if /^([0-9.]+(-SNAPSHOT)?)$/'
''', returnStdout: true
 

  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2017-03-21 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Jesse Glick updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-40514  
 
 
  Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
Change By: 
 Jesse Glick  
 
 
Component/s: 
 pipeline-utility-steps-plugin  
 
 
Component/s: 
 pipeline  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2017-03-21 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 This sounds like http://stackoverflow.com/questions/34068168/groovy-binding-cannot-cast-object-with-class-custompackage-customclass-to-cla - could you try doing def mavenProject = readMavenPom(file: pom) instead of Model mavenProject ... and see if that helps?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2017-01-16 Thread sas...@akv-soft.de (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Sascha Volkenandt commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Ditto with Jenkins 2.19.1, Pipeline 2.4 and Pipeline Utility Steps 1.2.2 It used to work though with 2.19.1, Pipeline 2.4 and Pipeline Utility Steps 1.1.6  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2016-12-22 Thread medy.belmokh...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 medy belmokhtar commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Same issue jenkins 2.37, Pipeline 2.4 and Pipeline Utility Steps 1.2.2  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2016-12-16 Thread tim.ea...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Tim Eapen edited a comment on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Stacktrace for the above error : .  Lookse like the DefautlTypeTransformation class cannot cast the return object properly. {code:java}hudson.remoting.ProxyException: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.foo:bar-api:jar:0.6.1-201612161044.0777507' with class 'org.apache.maven.model.Model' to class 'org.apache.maven.model.Model' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:603) at Unknown.Unknown(Unknown) at maven.purgeLocalRepository(/var/jenkins_home/jobs/rbcone-shared-authorization-api/branches/master/builds/16/libs/commons/vars/maven.groovy:9) at WorkflowScript.cleanup(WorkflowScript:33) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.set(LocalVariableBlock.java:45) at com.cloudbees.groovy.cps.impl.AssignmentBlock$ContinuationImpl.assignAndDone(AssignmentBlock.java:70) at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63) 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)Finished: FAILURE{code}  
 

  
 
 
  

[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2016-12-16 Thread tim.ea...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Tim Eapen commented on  JENKINS-40514  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
 Stacktrace for the above error: 

 

hudson.remoting.ProxyException: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.foo:bar-api:jar:0.6.1-201612161044.0777507' with class 'org.apache.maven.model.Model' to class 'org.apache.maven.model.Model'
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232)
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:603)
	at Unknown.Unknown(Unknown)
	at maven.purgeLocalRepository(/var/jenkins_home/jobs/rbcone-shared-authorization-api/branches/master/builds/16/libs/commons/vars/maven.groovy:9)
	at WorkflowScript.cleanup(WorkflowScript:33)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.set(LocalVariableBlock.java:45)
	at com.cloudbees.groovy.cps.impl.AssignmentBlock$ContinuationImpl.assignAndDone(AssignmentBlock.java:70)
	at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
	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)
Finished: FAILURE
 

  

[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2016-12-16 Thread tim.ea...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Tim Eapen updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-40514  
 
 
  Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
Change By: 
 Tim Eapen  
 

  
 
 
 
 

 
 {code:java}import org.apache.maven.model.ModelModel mavenProject = readMavenPom(file: pom){code}The above groovy script causes a ClassCastException when executing a Pipeline script:{code:java}[Pipeline] echoMarking build as failure due to the following error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com. rbc.rbcone.shared.authorization foo : rbcone bar - shared-authorization- api:jar:0.6.1-201612151515.0777507' with class 'org.apache.maven.model.Model' to class 'org.apache.maven.model.Model'[Pipeline] stage{code}  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.

[JIRA] (JENKINS-40514) Typing Return Value of readMavenPom Causes ClassCastException

2016-12-16 Thread tim.ea...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Tim Eapen created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-40514  
 
 
  Typing Return Value of readMavenPom Causes ClassCastException   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 pipeline  
 
 
Created: 
 2016/Dec/16 3:41 PM  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Tim Eapen  
 

  
 
 
 
 

 
 

 

import org.apache.maven.model.Model

Model mavenProject = readMavenPom(file: pom)
 

 The above groovy script causes a ClassCastException when executing a Pipeline script: 

 

[Pipeline] echo
Marking build as failure due to the following error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.rbc.rbcone.shared.authorization:rbcone-shared-authorization-api:jar:0.6.1-201612151515.0777507' with class 'org.apache.maven.model.Model' to class 'org.apache.maven.model.Model'
[Pipeline] stage