how to remove .jsp from .jar files after overlay is processed
문제
I've a maven module named views
containing one .jsp file \Calendar.jsp. I've another maven module named core
, which is dependent on views
module. The packaging type of views
module is jar whereas that of core
module is war.
I've configured overlay
to copy the .jsp files from views.jar
to WEB-INF\views folder (of core.war
).
<configuration>
<overlays>
<overlay>
<groupId>org.opensource</groupId>
<artifactId>views</artifactId>
<type>jar</type>
<includes>
<include>**/*.jsp</include>
</includes>
<targetPath>WEB-INF/views</targetPath>
</overlay>
</overlays>
</configuration>
The overlay
configuration works fine and it does copy .jsp files from views.jar
to WEB-INF\views folder(of core.war
).
But the problem is that it does not remove these .jsp files from the views.jar
. So, my core.war
ends up with duplicate .jsp files (one copy in WEB-INF/views folder and the other copy in views.jar
). As a result the size of the core.war
increases drastically. (The .jsp files which are in views.jar
are redundant because they will not be used during the execution of webapp.)
So, the question is:- How to configure overlay
to do Cut+Paste operation instead of Copy+Paste operation. If this cannot be done using overlay
, is there any other (maven friendly) solution?
해결책
Maven likes to avoid tampering with dependent artifacts that have already been installed in the local or remote repositories. I'm sure that's the case your going to find here with any solution from the overlay functionality for your war module.
There's another way to resolve this and that is to take a step back and look at your views module again. What you really need to do is create two jars with the views module, one that contains all the classes, the other contains just the JSP files and saving that artifact with a classifier. You may have to use the assembly plugin to accomplish this. In the Core module, take the JSP artifact with the classifier and then use that to overlay the module's war creation.