Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-16990

unable to resolve class hudson.maven.reporters.SurefireAggregatedReport in groovy template

    Details

    • Similar Issues:

      Description

      1. Edit a groovy template and add a reference to hudson.maven.reporters.SurefireAggregatedReport.

      2. Test the template using the testing instructions on the wiki at https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-TestingTemplates

      EXPECTING: email is sent.

      ACTUAL: Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript52.groovy: 121: unable to resolve class hudson.maven.reporters.SurefireAggregatedReport @ line 121, column 1. import hudson.maven.reporters.SurefireAggregatedReport ^ SimpleTemplateScript52.groovy: 128:

      This prevents someone from displaying the JUnit test results. Basically, I'm trying to copy and then modify ScriptContentBuildWrapper.getJUnitTestResult() as a starting point.

      If I try to access ScriptContentBuildWrapper, I get this error -

      Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript58.groovy: 136: unable to resolve class hudson.plugins.emailext.plugins.content.ScriptContentBuildWrapper @ line 136, column 1. import hudson.plugins.emailext.plugins.content.ScriptContentBuildWrapper ^ 1 error

        Attachments

          Issue Links

            Activity

            joshunger Josh Unger created issue -
            joshunger Josh Unger made changes -
            Field Original Value New Value
            Description 1. Edit a groovy template and add a reference to hudson.maven.reporters.SurefireAggregatedReport.

            2. Test the template using the testing instructions on the wiki at https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-TestingTemplates

            EXPECTING: email is sent.

            ACTUAL: Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript52.groovy: 121: unable to resolve class hudson.maven.reporters.SurefireAggregatedReport @ line 121, column 1. import hudson.maven.reporters.SurefireAggregatedReport ^ SimpleTemplateScript52.groovy: 128:

            This prevents someone from displaying the JUnit test results. Basically, I'm trying to copy and then modify ScriptContentBuildWrapper.getJUnitTestResult() as a starting point.
            1. Edit a groovy template and add a reference to hudson.maven.reporters.SurefireAggregatedReport.

            2. Test the template using the testing instructions on the wiki at https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-TestingTemplates

            EXPECTING: email is sent.

            ACTUAL: Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript52.groovy: 121: unable to resolve class hudson.maven.reporters.SurefireAggregatedReport @ line 121, column 1. import hudson.maven.reporters.SurefireAggregatedReport ^ SimpleTemplateScript52.groovy: 128:

            This prevents someone from displaying the JUnit test results. Basically, I'm trying to copy and then modify ScriptContentBuildWrapper.getJUnitTestResult() as a starting point.

            If I try to access ScriptContentBuildWrapper, I get this error -

            Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript58.groovy: 136: unable to resolve class hudson.plugins.emailext.plugins.content.ScriptContentBuildWrapper @ line 136, column 1. import hudson.plugins.emailext.plugins.content.ScriptContentBuildWrapper ^ 1 error
            Hide
            slide_o_mix Alex Earl added a comment -

            What versions of email-ext and Jenkins are you using? Also, can you paste your template and test code?

            Show
            slide_o_mix Alex Earl added a comment - What versions of email-ext and Jenkins are you using? Also, can you paste your template and test code?
            Hide
            joshunger Josh Unger added a comment -

            Jenkins 1.477. email-ext 2.25. Can you try a Groovy script with just <% import hudson.maven.reporters.SurefireAggregatedReport %> ? I can paste my template tomorrow. How do you tell Groovy what libs/jars to reference?

            Show
            joshunger Josh Unger added a comment - Jenkins 1.477. email-ext 2.25. Can you try a Groovy script with just <% import hudson.maven.reporters.SurefireAggregatedReport %> ? I can paste my template tomorrow. How do you tell Groovy what libs/jars to reference?
            Hide
            slide_o_mix Alex Earl added a comment -

            You can't really import external jars/libs easily, you'd have to write all the code to load the library dynamically and such, which would be a pain. Since its a Jenkins package though, it should be available. I'll try the import you suggested.

            Show
            slide_o_mix Alex Earl added a comment - You can't really import external jars/libs easily, you'd have to write all the code to load the library dynamically and such, which would be a pain. Since its a Jenkins package though, it should be available. I'll try the import you suggested.
            Hide
            slide_o_mix Alex Earl added a comment -

            I see the same issue with the script you recommended. Not sure why yet.

            Show
            slide_o_mix Alex Earl added a comment - I see the same issue with the script you recommended. Not sure why yet.
            Hide
            joshunger Josh Unger added a comment -

            Thanks, I was going to ask... how one might use Joda Time...

            Show
            joshunger Josh Unger added a comment - Thanks, I was going to ask... how one might use Joda Time...
            Hide
            slide_o_mix Alex Earl added a comment -

            No idea

            Show
            slide_o_mix Alex Earl added a comment - No idea
            Hide
            slide_o_mix Alex Earl added a comment -

            I've been toying with the idea of making sure grape works, but haven't gotten very far.

            http://groovy.codehaus.org/Grape

            Show
            slide_o_mix Alex Earl added a comment - I've been toying with the idea of making sure grape works, but haven't gotten very far. http://groovy.codehaus.org/Grape
            Hide
            slide_o_mix Alex Earl added a comment -

            Instead of importing, can you try using the full class name later in your script?

            Show
            slide_o_mix Alex Earl added a comment - Instead of importing, can you try using the full class name later in your script?
            Hide
            slide_o_mix Alex Earl added a comment -

            Set the class loader for the SimpleTemplateEngine.

            Show
            slide_o_mix Alex Earl added a comment - Set the class loader for the SimpleTemplateEngine.
            slide_o_mix Alex Earl made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            randycoulman Randy Coulman made changes -
            Link This issue is related to JENKINS-20355 [ JENKINS-20355 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 147820 ] JNJira + In-Review [ 192598 ]

              People

              • Assignee:
                slide_o_mix Alex Earl
                Reporter:
                joshunger Josh Unger
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: