Is It Possible To Have Maven "WAR" Pom.xml Package Up My Classes Up In A JAR And Put The JAR In The /WEB-INF/lib Folder?

- 1 answer

I have a simple Java Spring MVC web app. I build the WAR file using a Maven pom.xml file.

When I do a "maven install", it produces a WAR file with my compiled Java classes in the /WEB-INFO/classes folder.

My maven pom.xml looks like this (dependencies commented out) ...

<project xmlns="" xmlns:xsi=""
    <name>My Application</name>

<!-- .... -->


Next I want to obfuscate my Java classes (I'll be using Allatori obfuscater), so I'm thinking the easiest thing would be if my Java classes were all put into their own JAR file and stored in the /WEB-INF/lib folder with the rest of the JARs.

Is there a way to modify my Maven pom.xml file so it will package of my classes up in a JAR and put the JAR in the /WEB-INF/lib folder?


Adding this to the 'build' section (as suggested by "JF Meier" worked) ...





You can use the <archiveClasses> configuration (set it to true) to generate an additional jar with the classes.

Also see: