Is it possible to compile all the JSPs at build time and deliver them in the /classes folder of the WAR?

I have a Java / Spring MVC web app in a WAR file.

The WAR file will be downloaded by corporate customers, so I need to obfuscate the classes in the WAR. The obfuscater I’m using (Allatori) nicely obfuscates all of the classes in the /classes folder in the WAR.

The problem is, the JSPs (which are uncompiled) are referencing the Java classes by their original (unobfuscated) names.

I’m thinking if the JSPs were compiled and in the /classes folder, the obfuscater would get those too.

My question is … is there a way to compile the JSPs at build time and have them included in the /classes folder?

Add Comment
1 Answer(s)

You can use The Apache Sling JSPC Maven Plugin which does exactly what you need.

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.