简体   繁体   English

如何取消保留或强制删除 ProGuard 中 JPA 实体中的 @javax.persistence.Transient 注释方法?

[英]How to unkeep or force remove @javax.persistence.Transient annotated methods in JPA entities in ProGuard?

I'm extracting JPA entities into a separate Fat/Uber jar for external system to use.我将 JPA 实体提取到单独的 Fat/Uber jar 以供外部系统使用。 ProGuard is used through com.github.wvengen:proguard-maven-plugin to shrink all other unused code.通过 com.github.wvengen:proguard-maven-plugin 使用 ProGuard 来缩小所有其他未使用的代码。 I want to keep all methods in JPA entities except ones annotated by @javax.persistence.Transient annotation.我想将所有方法保留在 JPA 实体中,但由 @javax.persistence.Transient 注释注释的方法除外。 I've found ",transient" for field modifiers in ProGuard rules.我在 ProGuard 规则中为字段修饰符找到了“,transient”。 but seems that.@javax:persistence?Transient for methods does not work :( Can I reach the same effect somehow for methods by other way ?但似乎。@javax:persistence?Transient 方法不起作用:(我可以通过其他方式以某种方式达到相同的效果吗?

Unfortunately I've not got an answer on this question and was not be able to solve this by ProGuard+MavenPlugin directly, but I've resolved this problem with one additional step before run a ProGuard.不幸的是,我没有得到关于这个问题的答案,并且无法通过 ProGuard+MavenPlugin 直接解决这个问题,但是我在运行 ProGuard 之前通过一个额外的步骤解决了这个问题。 I've just used ByteBuddy + Maven plugin on Maven phase before you run ProGuard Maven plugin and it will then optimize/remove the rest unused stuff, see details about byte-buddy instrumentation step here: byte-buddy remove/strip methods I've just used ByteBuddy + Maven plugin on Maven phase before you run ProGuard Maven plugin and it will then optimize/remove the rest unused stuff, see details about byte-buddy instrumentation step here: byte-buddy remove/strip methods

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM