[英]Using an obfuscator with OSGi declarative services
我正在嘗試使用來自 Maven 的 ProGuard 來混淆我的 OSGi 程序。 我還使用 SCR 插件來處理聲明式服務。
不幸的是,ProGuard 混淆了類中的所有名稱,但並不容易理解與 serviceComponents.xml 文件的關系。
我應該能夠編寫一個使用 ProGuard 混淆字典來解決這個問題的程序,但我想知道是否已經有一些東西了。
換句話說:
謝謝!
我知道沒有現成的解決方案。
我認為最好的方法是手動或自動解析您的服務組件聲明以提取所有相關的類和方法名稱,並在這些類和方法上使用 ProGuard keepnames
選項。
以下 proguard 配置可以幫助您
#Keep all annotations, exceptions.
-keepattributes *Annotation*,Exceptions
#Keep all interfaces. This is required to run OSGi services.
-keep public interface *
#Keep all Component classes
-keep @org.osgi.service.component.annotations.Component class *
#Kepp all Component classes member functions with OSGi specific annotations
-keepclassmembers @org.osgi.service.component.annotations.Component class * {
#Keep all methods with annotatios Reference.
@org.osgi.service.component.annotations.Reference *;
#Keep all methods with annotatios Activate.
@org.osgi.service.component.annotations.Activate *;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.