At present the shade plugin doesn't really support war files. The classes that 
are shaded are written into the root of the output artefact, and the 
WEB-INF/classes path component is mistakenly taken to be part of the package 
name.

I have created a fork of the repository and added a new configuration setting:

<rootDirInArchive>WEB-INF/classes</rootDirInArchive>

With this set, the project artefact that is treated specially when compared to 
its dependencies. The result is that the shaded and potentially relocated 
classes and resources are added to the WEB-INF/classes folder. The correct 
behaviour is taken to correctly identify and deal with duplicates using the 
existing logic i.e. to avoid any exceptions from duplicate entries in the 
resultant war.

I have a rudimentary test case, and am successfully using this in one of my own 
projects. Before I complete these tests, open a Jira, and make a pull request, 
I would like to ensure that the feature would be appreciated.

I am interested to know why this behaviour has never been added previously.

Would the more flexible option of specifying the root directory in the archive 
be preferred? Or would it be preferable to have either a Boolean 
<warArtifact>true</warArtifact>, or even to do this automatically based on the 
file extension of the project artifact?

At present I remove the shaded artefacts in the maven-war-plugin using the 
packagingExcludes config. I could also extend the shade plugin to do this 
automatically. Would that feature be required for me to contribute?

I appreciate your input and feedback

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to