简体   繁体   English

如何通过Maven类进行编译以排除注释

[英]How to compile by maven classes exclude Annotation

I have maven module where defined JPA Entities with EntityListeners, these entities will used on other GUI project , this entities will be transferred using RMI or EJB, but I do not want provide to GUI project any information about Annotation of this entities and EventityListeners and include dependents JPA to GUI project. 我有一个maven模块,其中使用EntityListeners定义了JPA实体,这些实体将在其他GUI项目上使用,将使用RMI或EJB传输此实体,但是我不希望向GUI项目提供有关此实体和EventityListeners注释的任何信息,包括将JPA依赖于GUI项目。

Is it possible to compile first module without Annotation and add depends clear jar to GUI? 是否可以在没有注释的情况下编译第一个模块,并向GUI添加依赖的透明jar? and will it be correct restored Entity after transfer from server(annotated) module on GUI part ? 从GUI上的服务器(带注释)模块传输后,恢复的实体是否正确?

Annotations are not stored in the classes when the retention policy is not RUN TIME. 当保留策略不是“运行时间”时,注释不存储在类中。 Hence if you could use an alternative jar to redefine these annotations, it would be possible. 因此,如果您可以使用其他jar重新定义这些注释,则有可能。

A more feasible solution would be setting the target Java version for compilation to the one before run time annotations (< Java 1.5). 一种更可行的解决方案是将要编译的目标Java版本设置为运行时注释之前的版本 (<Java 1.5)。

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

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