Re: Using @grab to fetch SNAPSHOT jar in groovy sometimes can't be recoganized correctly if updating the SNAPSHOT

2018-11-02 Thread pan
Updates:

It might not be a good idea to use @grab in Jenkins pipeline script.

We also found an issue about this: 
https://issues.jenkins-ci.org/browse/JENKINS-48974, this will cause the 
parallel jobs which @grab the same direct/indirect dependencies failed.

It seems related to the groovy/ivy issue: 
https://issues.apache.org/jira/browse/GROOVY-7407. And it’s not fixed yet…
We also consider the way of @Library, but in the groovy lib, we still need 
@grab 3rd party lib, which is the same situation.

Anyway, we refactor the dependencies into a service and call rest api from 
the pipeline script, it seems working.

BR
Wei 

在 2018年10月8日星期一 UTC+2下午4:34:58,pan写道:
>
> Hi,
>
> I got an issue when using @grab.
> We are developing a jar and pipeline script to do the CI. We modify some 
> java code, deploy onto our internal Nexus server, use @grab in groovy to 
> fetch it to call the function.
> During developing, we found when we modify some code, deploy a new 
> SNAPSHOT version with the same version number of jar, sometimes the 
> pipeline script is not working.
>
> For example:
>
> @GrabResolver(name='Internal Nexus Snapshot', root='
>> https://internal.nexus.com/')
>> @Grab('some-package:some-artifact:0.0.1-SNAPSHOT')
>> import some.Utils
>> println new Utils()
>
>
> It works well, but if I deploy a new version to Nexus, it might fail, 
> unless I restart the Jenkins, then it will work again.
>
> error message:
>
> Running in Durability level: MAX_SURVIVABILITY
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> WorkflowScript: 1: unable to resolve class some.Utils
>  @ line 1, column 1.
>@GrabResolver(name='Internal Nexus Snapshot', 
> root='https://internal.nexus.com/')
>^
>
> 1 error
>
>   at 
> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
>   at 
> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
>   at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
>   at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
>   at 
> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
>   at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
>   at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
>   at 
> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
>   at 
> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
>   at 
> org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
>   at 
> org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
>   at 
> org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
>   at hudson.model.ResourceController.execute(ResourceController.java:97)
>   at hudson.model.Executor.run(Executor.java:421)
> Finished: FAILURE
>
>
>
> I think it might be some cache in Jenkins, because restart Jenkins will 
> fix it. But I can't find it.
> Does anyone have any clue about this?
> Thank you very much.
>
>
>

-- 
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/9c0ce05c-5308-4a95-9529-af7d9331bfe2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using @grab to fetch SNAPSHOT jar in groovy sometimes can't be recoganized correctly if updating the SNAPSHOT

2018-10-08 Thread pan
Hi,

I got an issue when using @grab.
We are developing a jar and pipeline script to do the CI. We modify some 
java code, deploy onto our internal Nexus server, use @grab in groovy to 
fetch it to call the function.
During developing, we found when we modify some code, deploy a new SNAPSHOT 
version with the same version number of jar, sometimes the pipeline script 
is not working.

For example:

@GrabResolver(name='Internal Nexus Snapshot', 
> root='https://internal.nexus.com/')
> @Grab('some-package:some-artifact:0.0.1-SNAPSHOT')
> import some.Utils
> println new Utils()


It works well, but if I deploy a new version to Nexus, it might fail, 
unless I restart the Jenkins, then it will work again.

error message:

Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 1: unable to resolve class some.Utils
 @ line 1, column 1.
   @GrabResolver(name='Internal Nexus Snapshot', 
root='https://internal.nexus.com/')
   ^

1 error

at 
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at 
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at 
org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at 
org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at 
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at 
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at 
org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Finished: FAILURE



I think it might be some cache in Jenkins, because restart Jenkins will fix 
it. But I can't find it.
Does anyone have any clue about this?
Thank you very much.


-- 
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/56f3398c-9d7c-4192-96d1-bedaf7fb4adf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.