1

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 without changing the WAR filename?

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

ethanxyz_0
  • 713
  • 12
  • 37
  • How are you deploying your WAR file? – Steve C May 19 '17 at 04:15
  • Copying the .war file into deployments directory. I could deploy it with jboss-cli and choose the right name, but here the "standard deployment procedure" is copying the file into wildfly's deployments directory. – ethanxyz_0 May 19 '17 at 04:25
  • 1
    So specify my-project.war... in your pom.xml file. – Steve C May 19 '17 at 04:47
  • Nah.. The file comes from Nexus downloaded and copied by a script (nexus names artifacts files with versions). And there is an another script thats collects the deployed projects version parsing it's file name. – ethanxyz_0 May 19 '17 at 05:04
  • 2
    I thought that might be a problem - we do that here too. I think you need to update one or more of your scripts to resolve this. Remember that the simplest solution is the best solution! – Steve C May 19 '17 at 05:39
  • I agree. I was trying to avoid changing the scripts. Also it's nice to just look at the content of deployments and know all project's versions. If only we could change the module name without change the file name... Like changing the context root just including a jboss-web.xml file. – ethanxyz_0 May 19 '17 at 06:00

0 Answers0