sancho21
(Ichsan)
1
I believe EAR plugin generates wrong deployment for J2EE 1.3 as it causes 3 errors on the file.
- It puts “version” attribute on
<application element>
when it should not.
This is what to be expected:
`
`
But… this is the reality:
`
`
-
The other thing is, it create invalid element <library-directory>
when it should not.
-
It generates elements in wrong order.
It should generate:
<display-name>X-interface</display-name> <description>X Interface Desc</description>
But the reality:
<description>X Interface Desc</description> <display-name>X-interface</display-name>
Please fix this 3 errors.
sterling
(Sterling Greene)
2
Thanks. Which application container is this failing with?
As a workaround, you can tweak the generated XML:
ear {
deploymentDescriptor {
version = '1.3'
displayName = "foo"
description = "description of foo"
withXml {
def rootNode = it.asNode()
rootNode.attributes().remove('version')
rootNode.remove(rootNode.'library-directory')
}
}
}
sancho21
(Ichsan)
3
It is with Oracle WebLogic 10.3.0.0.
By the way. Your workaround is still unable to solve the order problem.
sterling
(Sterling Greene)
4
It generates in the “correct” order for me and I would hope it doesn’t really matter.
You can modify the generated XML through this API: https://docs.gradle.org/current/javadoc/org/gradle/plugins/ear/descriptor/DeploymentDescriptor.html
What happens when the elements are in the other order?
sancho21
(Ichsan)
5
Actually, the order is not correct according to the DTD.
This is my final fix:
// Work around bugs in generated application.xml file to comply with J2EE 1.3 spec
withXml {
def appXml = it.asNode()
// Remove invalid nodes
appXml.attributes().remove('version')
appXml.remove(appXml.'library-directory')
// Fix wrong order
def desc = appXml.'description'[0]
def disp = appXml.'display-name'[0]
disp.replaceNode(desc)
desc.replaceNode(disp)
}
Anyway, thank you for your workaround