Gradle 2.0 ear plugin: Error when existing application.xml contains a <!DOCTYPE>


(Mike Meessen) #1

The ear plugin can handle pre-existing application.xml files. Since Gradle 2.0, we get the following error when Gradle tries to load our existing application.xml file. This happens during the config phase:

* What went wrong:
A problem occurred evaluating project ':myproj'.
> DOCTYPE ist nicht zulõssig, wenn das Feature "http://apache.org/xml/features/disallow-doctype-decl" auf "true" ges
etzt ist.
  * Try:
Run with --info or --debug option to get more log output.
  * Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':myproj'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:187)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:470)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:79)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:128)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:105)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:85)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:81)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 10; DOCTYPE ist nicht zulõssig, wenn das Feature "http://apache.org/xml/features/disallow-doctype-decl" auf "true" gesetzt ist.
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
        at org.gradle.plugins.ear.descriptor.internal.DefaultDeploymentDescriptor.readFrom(DefaultDeploymentDescriptor.groovy:124)
        at org.gradle.plugins.ear.descriptor.DeploymentDescriptor$readFrom$0.callCurrent(Unknown Source)
        at org.gradle.plugins.ear.descriptor.internal.DefaultDeploymentDescriptor.readFrom(DefaultDeploymentDescriptor.groovy:115)
        at org.gradle.plugins.ear.descriptor.DeploymentDescriptor$readFrom.call(Unknown Source)
        at org.gradle.plugins.ear.EarPluginConvention.setAppDirName(EarPluginConvention.groovy:33)
        at org.gradle.plugins.ear.EarPluginConvention_Decorated.setAppDirName(Unknown Source)
        at org.gradle.plugins.ear.EarPlugin.apply(EarPlugin.java:66)
        at org.gradle.plugins.ear.EarPlugin.apply(EarPlugin.java:45)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:110)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:69)
        at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:35)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:117)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:85)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:130)
        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:41)
        at org.gradle.api.Project$apply.call(Unknown Source)
        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
        at org.gradle.api.Script$apply.callCurrent(Unknown Source)
        at build_6pugcq4j960klpu404q8an7udg.run(D:\myproj\build.gradle:2)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
        ... 31 more
    BUILD FAILED

The DOCTYPE is required by at least some Application servers. See: http://docs.oracle.com/cd/E13222_01/wls/docs81/programming/app_xml.html

I uploaded a minimalistic project reproducing the error. Just try to run any gradle task in it: https://dl.dropboxusercontent.com/u/54390273/dev/ear-proj.zip

Best regards, Mike


(Mike Meessen) #2

push as this still hasn’t been acknowledged and is a shop stopper for EAR projects.


(Luke Daley) #3

Hi,

Are you interested in submitting a fix for this?


(Mike Meessen) #4

Here we go :slight_smile:

https://github.com/gradle/gradle/pull/311