java.lang.NoSuchMethodError: No such DSL method 'scanForIssues' found among steps

1,298 views
Skip to first unread message

dean warren

unread,
Oct 26, 2018, 5:51:47 AM10/26/18
to Jenkins Users

I am trying to get the Warnings plugin collecting CheckStyle results within a pipeline.

I believe I am using all the latest versions of pipeline related modules, and the warnings modules.

 

A simplified version of my Jenkinsfile is something like:


timestamps {
    node ('name') {
            try
            {
                stage ('Checkout') {
                    checkout scm
                }
                stage ('Build & Test') {
                    sh 'bash -x test.sh'
                }
                stage ('CheckStyle') {
                    sh 'java -jar /home/user/checkstyle/checkstyle-6.5-all.jar -c /home/user/checkstyle.xml -f xml -c target/checkstyle-results.xml src'
// Doesn't work
//                    step([$class: 'CheckStylePublisher',
//                        canRunOnFailed: true,
//                        defaultEncoding: '',
//                        healthy: '100',
//                        pattern: '**/target/checkstyle-result.xml',
//                        unHealthy: '90',
//                        useStableBuildAsReference: true
//                        ])
// Doesn't work
//                    step([$class: 'WarningsPublisher', consoleParsers: [[parserName: 'CheckStyle']]])
       
// Doesn't work
                    def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/target/checkstyle-result.xml'
                    publishIssues issues:[checkstyle]
                }
            }
            catch (caughtErr)
            {
            }
            finally
            {
            }
    }
}

Where I have tried three different methods to collect the checkstype results, none of which work (I have left two of them commented out for reference - but beleive these are methods for the legacy checkstyle plugin, not the newly integrated warnigns plugin?).


I believe the last method using scanForIssues is the correct method as per here:

https://github.com/jenkinsci/warnings-plugin/blob/master/Jenkinsfile.local

 

However on build, I see the checkstyle results being generated, but get the following error message

java.lang.NoSuchMethodError: No such DSL method 'scanForIssues' found among steps

Any ideas?
Thanks in advance!


Ulli Hafner

unread,
Oct 27, 2018, 1:07:49 PM10/27/18
to jenkins...@googlegroups.com


Von meinem iPad gesendet

Am 26.10.2018 um 09:50 schrieb dean warren <dean.wa...@gmail.com>:

I am trying to get the Warnings plugin collecting CheckStyle results within a pipeline.

I believe I am using all the latest versions of pipeline related modules, and the warnings modules.

 

A simplified version of my Jenkinsfile is something like:


timestamps {
    node ('name') {
            try
            {
                stage ('Checkout') {
                    checkout scm
                }
                stage ('Build & Test') {
                    sh 'bash -x test.sh'
                }
                stage ('CheckStyle') {
                    sh 'java -jar /home/user/checkstyle/checkstyle-6.5-all.jar -c /home/user/checkstyle.xml -f xml -c target/checkstyle-results.xml src'
// Doesn't work
//                    step([$class: 'CheckStylePublisher',
//                        canRunOnFailed: true,
//                        defaultEncoding: '',
//                        healthy: '100',
//                        pattern: '**/target/checkstyle-result.xml',
//                        unHealthy: '90',
//                        useStableBuildAsReference: true
//                        ])

This publisher requires the CheckStyle plugin.

// Doesn't work
//                    step([$class: 'WarningsPublisher', consoleParsers: [[parserName: 'CheckStyle']]])
       

The warnings publisher from the 4.x version does not support CheckStyle yet.
 
// Doesn't work
                    def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/target/checkstyle-result.xml'
                    publishIssues issues:[checkstyle]
                }
            }
            catch (caughtErr)
            {
            }
            finally
            {
            }
    }
}


Did you install the 5.0 beta version of the plugin? This step is not available in the 4.x version.

Where I have tried three different methods to collect the checkstype results, none of which work (I have left two of them commented out for reference - but beleive these are methods for the legacy checkstyle plugin, not the newly integrated warnigns plugin?).


I believe the last method using scanForIssues is the correct method as per here:

https://github.com/jenkinsci/warnings-plugin/blob/master/Jenkinsfile.local

 

However on build, I see the checkstyle results being generated, but get the following error message

java.lang.NoSuchMethodError: No such DSL method 'scanForIssues' found among steps

Any ideas?
Thanks in advance!


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/00750112-2e37-4213-91b3-01c87686433c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dean warren

unread,
Oct 29, 2018, 10:02:45 AM10/29/18
to jenkins...@googlegroups.com
Thanks @ulli for your reply.

'Did you install the 5.0 beta version of the plugin? This step is not available in the 4.x version.'
Ahh... :) No. Where do I get that from and how to install in Jenkins?

def

unread,
Oct 29, 2018, 10:09:27 AM10/29/18
to Jenkins Users
OK, from here:

But Jnekins requires a .hpi file.
Do I have to build this, or package it somehow?
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

sagar utekar

unread,
Oct 29, 2018, 10:22:12 AM10/29/18
to jenkins...@googlegroups.com
from here you can download hpi file for warnings plugin

and add it using upload section of manage plugin -> advanced section

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

--
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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1d291cec-9b90-44bb-9a82-cd47b0db906b%40googlegroups.com.

dean warren

unread,
Oct 29, 2018, 10:43:47 AM10/29/18
to jenkins...@googlegroups.com
Thanks @sagar for your reply.

But the link https://updates.jenkins.io/download/plugins/warnings/ does not contain version 5.0. Perhaps because this is a beta?

So do I have to build / repackage it, of is there another link that will give me the .hpi file?

Ulli Hafner

unread,
Oct 29, 2018, 12:28:31 PM10/29/18
to jenkins...@googlegroups.com
You need to point your update center to the experimental update center url, see https://jenkins.io/doc/developer/publishing/releasing-experimental-updates/

Von meinem iPad gesendet

deanwarrenuk

unread,
Oct 30, 2018, 5:48:10 AM10/30/18
to Jenkins Users

dean warren

unread,
Oct 30, 2018, 6:48:52 AM10/30/18
to jenkins...@googlegroups.com
Awesome, that works! Thanks guys.

One last question... :) Where can I find info for the 'pattern' part of the line
e.g.
def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/target/checkstyle-result.xml'

As my resutls are created in the dersired place (I can see them), but scanForIssues isn't finding the checkstyle-results.xml (I think)
i.e.
[CheckStyle] [ERROR] No files found for pattern '**/target/checkstyle-result.xml'. Configuration error?


Ullrich Hafner

unread,
Oct 30, 2018, 6:58:02 AM10/30/18
to Jenkins Users
You should see an info message in the snippet generator. The default (if left empty) is '**/checkstyle-result.xml‘. Or you can view the JavaDoc documentation (or documentation in https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md).

Is your file called checkstyle-result.xml or checkstyle-result*s*.xml?

signature.asc

dean warren

unread,
Oct 30, 2018, 7:15:40 AM10/30/18
to jenkins...@googlegroups.com

Ahh... I am clearly a doofus 's' !
Sorry, you know what its like, doing one thing with left hand, something else with other... and miss things.

So now I see the following
10:58:10 [CheckStyle] Searching for all files in '/home/user/workspace/TG.integrate_jenkins_ci-TKKXRODLMWWUDKMVKENHFQYQ7E2ZP5QAC72HYNHV6PXXEX75DW2Q' that match the pattern '**/target/checkstyle-results.xml'
10:58:10 [CheckStyle] -> found 1 file
10:58:10 [CheckStyle] Successfully parsed file /home/user/workspace/TG.integrate_jenkins_ci-TKKXRODLMWWUDKMVKENHFQYQ7E2ZP5QAC72HYNHV6PXXEX75DW2Q/target/checkstyle-results.xml
10:58:10 [CheckStyle] -> found 2983 issues (skipped 0 duplicates)

However the build now fails,I assume because of all of the checkstyle issues (all 2983 of them!) - this is fine.

But the checkstyle icon has dissapeared for this build.
e.g. a good build, but not finding the checkstyle file, so no build failure and the checkstyle icons appear but with no warnings/errors.
image.png
But on the failed build the icons have dissappeared.
image.png
How do I view the checkstyle warnings/errors in Jenksin?

dean warren

unread,
Oct 30, 2018, 7:17:15 AM10/30/18
to jenkins...@googlegroups.com
And also noted this for the same some, following emailing results

10:58:11 Sending e-mails to: ....
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] End of Pipeline
java.nio.charset.MalformedInputException: Input length = 1

Ullrich Hafner

unread,
Oct 30, 2018, 7:41:34 AM10/30/18
to Jenkins Users
This looks like an exception from one of the steps. Is there a stacktrace? If there is no result visible then this is due to an exception.

Am 30.10.2018 um 12:16 schrieb dean warren <dean.wa...@gmail.com>:

And also noted this for the same some, following emailing results

10:58:11 Sending e-mails to: ....
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] End of Pipeline
java.nio.charset.MalformedInputException: Input length = 1


On Tue, Oct 30, 2018 at 11:15 AM dean warren <dean.wa...@gmail.com> wrote:

Ahh... I am clearly a doofus 's' !
Sorry, you know what its like, doing one thing with left hand, something else with other... and miss things.

So now I see the following
10:58:10 [CheckStyle] Searching for all files in '/home/user/workspace/TG.integrate_jenkins_ci-TKKXRODLMWWUDKMVKENHFQYQ7E2ZP5QAC72HYNHV6PXXEX75DW2Q' that match the pattern '**/target/checkstyle-results.xml'
10:58:10 [CheckStyle] -> found 1 file
10:58:10 [CheckStyle] Successfully parsed file /home/user/workspace/TG.integrate_jenkins_ci-TKKXRODLMWWUDKMVKENHFQYQ7E2ZP5QAC72HYNHV6PXXEX75DW2Q/target/checkstyle-results.xml
10:58:10 [CheckStyle] -> found 2983 issues (skipped 0 duplicates)

However the build now fails,I assume because of all of the checkstyle issues (all 2983 of them!) - this is fine.

But the checkstyle icon has dissapeared for this build.
e.g. a good build, but not finding the checkstyle file, so no build failure and the checkstyle icons appear but with no warnings/errors.
<image.png>
But on the failed build the icons have dissappeared.
signature.asc

dean warren

unread,
Oct 30, 2018, 7:46:24 AM10/30/18
to jenkins...@googlegroups.com
StackTrace:

java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at java.io.BufferedReader$1.hasNext(BufferedReader.java:571)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to moftpa
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:310)
at hudson.remoting.Channel.call(Channel.java:908)
at hudson.FilePath.act(FilePath.java:986)
at hudson.FilePath.act(FilePath.java:975)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.postProcess(IssuesScanner.java:148)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scanInWorkspace(IssuesScanner.java:92)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:71)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:173)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:138)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
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)
Caused: java.io.UncheckedIOException
at java.io.BufferedReader$1.hasNext(BufferedReader.java:574)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1811)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at edu.hm.hafner.analysis.FullTextFingerprint.extractContext(FullTextFingerprint.java:111)
at edu.hm.hafner.analysis.FullTextFingerprint.createFingerprint(FullTextFingerprint.java:84)
at edu.hm.hafner.analysis.FullTextFingerprint.compute(FullTextFingerprint.java:73)
at edu.hm.hafner.analysis.FingerprintGenerator.run(FingerprintGenerator.java:35)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.createFingerprints(IssuesScanner.java:237)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:195)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:170)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2760)
at hudson.remoting.UserRequest.perform(UserRequest.java:207)
at hudson.remoting.UserRequest.perform(UserRequest.java:53)
at hudson.remoting.Request$2.run(Request.java:358)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
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)
Finished: FAILURE


deanwarrenuk

unread,
Oct 30, 2018, 8:16:41 AM10/30/18
to Jenkins Users
Looks like this is def an issue with the line
def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/mof-api/target/checkstyle-results.xml'

As removed all steps except that above and issue still occurs.


Do you have a known working checkstyle-results.xml file, just in case somethink funny with mine?
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsub...@googlegroups.com.

-- 
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+unsub...@googlegroups.com.

-- 
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+unsub...@googlegroups.com.

-- 
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+unsub...@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

deanwarrenuk

unread,
Oct 30, 2018, 8:47:06 AM10/30/18
to Jenkins Users
Have reduced the check-style from 200+ issues to just two. Works fine now.

So something incompatible with checkstyle-resutls.xml generated and the scanForIssues.
@Ullrich, can I send you the checkstyle-resutls.xml to debug (email? would prefer not to post file directly here)?

Or perhpas advise on how I can progress?

Ullrich Hafner

unread,
Oct 30, 2018, 10:31:00 AM10/30/18
to Jenkins Users
Can you add the encoding property:

checkstyle = scanForIssues reportEncoding='YOUR-ENCODING‘, ...

and replace YOUR-ENCODING with the encoding that is defined in the xml line of your checkstyle results.xml file? 

If this does not work, please create an issue in our issue tracker and attach the XML file. (Or if it is confidential you may also send it via email).


signature.asc

Ullrich Hafner

unread,
Oct 30, 2018, 10:32:18 AM10/30/18
to Jenkins Users
and one additional question: how is the checkstyle file created?
signature.asc

dean warren

unread,
Nov 1, 2018, 5:55:37 AM11/1/18
to jenkins...@googlegroups.com
What is the format for the scanForIssues line including the 'reportEncoding'.
I've done this e.g.
def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], reportEncoding='UTF-8', pattern: '**/mof-api/target/checkstyle-results.xml'
but it throws an error e.g.
java.lang.IllegalArgumentException: Expected named arguments but got [{tool={$class=CheckStyle}, pattern=**/mof-api/target/checkstyle-results.xml}, null]

And as requested the check-style file is generated from this command e.g.
sh 'java -jar /home/user/checkstyle/checkstyle-6.5-all.jar -c /home/user/Metrics_Checkstyle.xml -f xml -o target/checkstyle-results.xml src'


-- 
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.

-- 
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.

-- 
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.

-- 
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.

-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d3876eab-a906-47ca-a585-9840821a3e4f%40googlegroups.com.
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-use...@googlegroups.com.

Ullrich Hafner

unread,
Nov 1, 2018, 7:02:27 AM11/1/18
to Jenkins Users
Colon not Equals:

reportEncoding: 'UTF-8'

You are using an ancient checkstyle version, maybe this is the problem? Current version is 8.12.

signature.asc

dean warren

unread,
Nov 1, 2018, 7:23:18 AM11/1/18
to jenkins...@googlegroups.com
Ok so changed the scanForIssues line using the encoding as suggested. Even when using the latest checkstyle (8.14) I get the same error
e.g.
java.nio.charset.MalformedInputException: Input length = 1

Below is my current script (note we are using java 1.7 on the target, so have to explicity utilise 1.8 for latest checkstyle). 

sh '/home/user/jdk1.8.0_144/bin/java -jar /home/user/checkstyle/checkstyle-8.14-all.jar -c /home/user/Metrics_Checkstyle.xml -f xml -o target/checkstyle-results.xml mof-api/src'

def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/target/checkstyle-results.xml', reportEncoding: 'UTF-8'
publishIssues issues:[checkstyle]

What next?

Ullrich Hafner

unread,
Nov 1, 2018, 10:44:41 AM11/1/18
to jenkins...@googlegroups.com
Sorry, my fault. I should have read the stack trace more carefully.

Can you please set

sourceEncoding: 'YOUR-SOURCE-FILES-ENCODING‘

as well? The error is thrown during the fingerprinting. Here a different encoding is used.

Which encoding is used for your source code?

I created an issue:
The plugin should rather report a helpful text...

signature.asc
Reply all
Reply to author
Forward
0 new messages