The idea is there already for a long time, MSHADE-87 [1]
After some time my conclusion was, that in the end it is easier and more reliable to add a shaded jar to the webarchive instead of trying to solve this within the war. This doesn't mean that it could be supported by the maven-shade-plugin, but it requires quite some changes to the filters, etc because of the change of the output location.

thanks,
Robert

[1] https://issues.apache.org/jira/browse/MSHADE-87

On Fri, 08 Jun 2018 14:39:39 +0200, Matthew Amos <[email protected]> wrote:

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]

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

Reply via email to