Unable to add same webModule with different contextRoots in Gradle EAR plugin


(Andrey Adamovich) #1

The following configuration produces only single web module in the descriptor, but it should have 2:

ear {

libDirName ‘APP-INF/lib’

deploymentDescriptor {

version = “1.4”

displayName = ‘AuthenticationProxy’

webModule(‘authentication-proxy-web-1.0-SNAPSHOT.war’, ‘B2B’) // old endpoint

webModule(‘authentication-proxy-web-1.0-SNAPSHOT.war’, ‘AuthenticationProxy’)

}

}

This is the result:

<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
  <display-name>AuthenticationProxy</display-name>
  <module>
    <web>
      <web-uri>authentication-proxy-web-1.0-SNAPSHOT.war</web-uri>
      <context-root>B2B</context-root>
    </web>
  </module>
</application>

This is how it should be:

<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
  <display-name>AuthenticationProxy</display-name>
  <module>
    <web>
      <web-uri>authentication-proxy-web-1.0-SNAPSHOT.war</web-uri>
      <context-root>B2B</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>authentication-proxy-web-1.0-SNAPSHOT.war</web-uri>
      <context-root>AuthenticationProxy</context-root>
    </web>
  </module>
</application>

Of course, it easy to override by providing custom descriptor, but still it seems as a bug to me.