Search code examples
mavenjarwarear

Maven - how to unpack a jar and build the war files using unpacked files(class)


Is there any way to unpack a dependent jar and include the required class files from it to a war file.

I have two modules, namely module-A and module-B. Module-A packaged as jar, and module-B packaged as war. Module-A is added as dependency in module-B.

Now i get module-A jar file inside module-B. I need to include the class files, available inside Module-A jar file, into a specific folder in my war.

Any help would be highly appreciated, thanks in Advance!


Solution

  • I got it,

    It is as simple as to change the packaging of the new module to ear. Then the existing war module keep as it is.

    Put all the sub module dependency in ear module, make sure to add war tag for your war module dependency.

    I was not having good understanding about ear packaging.

    Any better idea would be appreciated, thanks in advance.