I have a java EAR project that contains some WAR web-app.
I'm using gradle to build the EAR file.
uberApp
|
\---> WarA
| |
| ...<src and config>
|
\---> WarB
| |
| ...<src and config>
|
\--> config/META-INF/application.xml
This is the uberApp build.gradle:
apply plugin: 'ear'
dependencies {
deploy project(path: ':WarA/trunk', configuration: 'archives')
deploy project(path: ':WarB/trunk', configuration: 'archives')
}
ear {
appDirName 'config'
}
This is the WAR build.gradle:
war {
baseName = 'WarA'
version = '1.2.3_rev' + getSvnRevision() // provided by SvnKit
}
...so resulting filename always contains the handwritten version number and the SVN commit number: WarA-1.2.3_rev31337.war
But I need to update my application.xml
with correct WAR filename inside tag before EAR
is assembled.
This is the EAR application.xml
:
<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="6">
<module>
<web>
<web-uri>WarA.war</web-uri>
<context-root>/WarA</context-root>
</web>
</module>
<module>
<web>
<web-uri>WarB.war</web-uri>
<context-root>/WarB</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
How can I achieve this?