jenkinsci / gradle-jpi-plugin

Build Jenkins Plugins with Gradle
79 stars 50 forks source link

GeneratedJenkinsTest Jelly Parsing Failing #229

Closed sghill closed 1 year ago

sghill commented 1 year ago

Running the generatedJenkinsTest task on recent Jenkins versions is failing to parse jelly files:

org.jenkinsci.plugins.generated.templating_engine.InjectedTest > org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.../config.jelly FAILED
    org.apache.commons.jelly.JellyException: Could not parse Jelly script : file:/.../config.jelly
        at org.apache.commons.jelly.JellyContext.compileScript(JellyContext.java:535)
        at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.runTest(JellyTestSuiteBuilder.java:102)

        Caused by:
        org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
            at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178)
            at org.apache.commons.jelly.parser.XMLParser.getXMLReader(XMLParser.java:554)
            at org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:368)
            at org.apache.commons.jelly.JellyContext.compileScript(JellyContext.java:531)
            ... 1 more

The default SAXParserFactory is unable to accept this setting. This can be fixed by setting a system property on the generatedJenkinsTest task:

systemProperty 'javax.xml.parsers.SAXParserFactory', 'com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl'