class override (same full class name)

following up with and, there are times where a class defined upstream (either third party or shared library internally) should be overriden.

The trick is to keep the class name exact with the same package name. when maven shaded the class, it would pick up the class from the closest level.

For example, if module ACore has a class names org.wordpress.util.DomainMapper, a class with the exact same name org.wordpress.util.DomainMapper could be created in A1 module to override the provided functionality.

when build module A with -amd, it would generated a A2 jar, which contains the compiled class binary from ACore. while the generated A1 jar, would contain the override class created in A1 module.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s