Here is plug-in I wrote for similar purposes.
Details can be seen here: https://github.com/yamanyar/restrict-maven-plugin/wiki
Restrict all access from com.ya* to java.util.regex.*
<restriction>com.ya* to java.util.regex.*</restriction>
Restrict all access from com.ya* (except com.yamanyar.core.) to java.util.regex.,
<restriction>com.ya*,!com.yamanyar.core.* to java.util.regex.*</restriction>
Restrict all access from com.ya* (except com.yamanyar.core.) and com.abc.Test to java.util.regex.
<restriction>com.ya*,com.abc.Test,!com.yamanyar.core.* to java.util.regex.*</restriction>
Restrict all access from com.ya* (except com.yamanyar.core.) and com.abc.Test to java.util.regex. ( except java.util.regex.Matcher) <restriction>com.ya*,com.abc.Test,!com.yamanyar.core.* to java.util.regex.*,!java.util.regex.Matcher</restriction>
Restrict all access from com.ya* ( except com.yamanyar.core.) and com.abc.Test to java.util.regex. ( except java.util.regex.Matcher); and also restrict com.ya* (except com.yamanyar.core.) to java.io.PrintStre.print*()
<restriction>com.ya*,com.abc.Test,!com.yamanyar.core.* to java.util.regex.*,!java.util.regex.Matcher</restriction>
<restriction>com.ya*,!com.yamanyar.core* to java.io.PrintStre*.print*()</restriction>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…