0 Replies Latest reply on May 18, 2017 8:42 PM by dbdbdb

    How to change the module name and slot of WAR deployment?

    dbdbdb

      I have a maven project and the name of generated .war file is "my-project-1.0.0-SNAPSHOT.war".

      And I try to get the name and slot of the war module with this code:

       

      Module module = Module.forClass(clazz);
      ModuleIdentifier identifier = module.getIdentifier();
      String name = identifier.getName();
      String slot = identifier.getSlot();
      

       

      The value of variable name is "deployment.my-project-1.0.0-SNAPSHOT.war" and slot is "main".

       

      How can I change the module name?

       

      I have this jboss-deployment-structure.xml (located in WEB-INF folder, I also tried in META-INF folder) file:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
          <deployment>
              <module-alias name="deployment.my-project" slot="main"/>
              <dependencies>
                  <module name="org.infinispan" services="import"/>
                  <module name="org.infinispan.commons" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

       

       

      but the module name remains with war filename (my-project-1.0.0-SNAPSHOT.war).

       

      Actually the main reason I want to change the module name is because I use the jboss-marshalling to serialize some java objects and the ModularClassResolver includes these modules informations (name and slot), making the serializated data not compatible when we change the project version and the .war file has another filename.

       

      Is there other way to change the module name of my project?

       

      Thanks