I am trying to assemble an ear with Gradle, wich application.xml
contains some non-ejb modules. The dependent project archives are generated with the {basename}-{version}.{extension}
standard and thus look something like, e.g. subproject-0.2.6.rar
. However, since some of these projects need to be marked as java or connector module, I have issues addressing the correct files.
This is what the build script looks like:
apply plugin: 'ear'
dependencies {
deploy project(':EJB-Project')
deploy project(':Commons')
deploy project(':UpdateManager')
earlib 'net.sf:jasperreports:unknown'
earlib 'org.apache.axis:axis:1.4'
}
ear {
deploymentDescriptor {
applicationName = 'EnterpriseProject'
module('Commons.jar', 'java')
module('UpdateManager.rar', 'connector')
}
// Remove the version postfix from archived files
rename(/(.*)-${version}(.)/, /$1$2/)
}
The jboss-deployment-structure.xml
has the archives in the sub-deployment nodes declared without the version specifier, too.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
...
<sub-deployment name="EJB-Project.jar">
<dependencies />
<exclusions />
</sub-deployment>
<sub-deployment name="Commons.jar">
<dependencies />
<exclusions />
</sub-deployment>
...
The rename method in the ear task successfully renames the libraries from the deploy
configuration, but Gradle adds the dependencies, which are not explicitly added via module(String path, String identifier)
automatically with their original name as ejb module:
<module>
<ejb>EJB-Project-4.5.2.jar</ejb>
</module>
I would love to solve this in a clean way - e.g., referencing the project itself in the module section, rather than specifying the file name (and its extension) and generating the deployment xml for JBoss, but I'm somehow stuck. I want all version strings to be removed, or keep all of them.