简体   繁体   English

使用Eclipse升级注释处理器代码(Java)时遇到问题

[英]Trouble with upgrading of annotation processor code(Java) using Eclipse

I`m an android-developer but this is question for java-developer I think: I have some wierd trouble with annotation processor behaviour. 我是一名Android开发人员,但这是Java开发人员的问题,我认为:注解处理器行为存在一些麻烦。

Now I`ve been developing 2 projects: one - with custom annotations and the processor, which process these custom annotations (lib-project) and the testing application which use this lib-project (test-project). 现在,我已经在开发2个项目:一个-具有自定义注释和处理器,用于处理这些自定义注释(lib-project)和使用该lib-project的测试应用程序(test-project)。 I use Eclipse IDE as a developer tool (ADT). 我将Eclipse IDE用作开发人员工具(ADT)。

And I faced such a trouble: my lib-project attached to test project as a jar-lib and at first it works quite well but if 我遇到了一个麻烦:我的lib-project以jar-lib的形式附加到测试项目中,起初它运行良好,

1) I made changes in my lib-project (made changes to my annotation processor), 1)我在lib项目中进行了更改(对注释处理器进行了更改),

2) then rebuilt jar-lib and 2)然后重建jar-lib和

3) cleaned and rebuilt my test-project then 3)然后清理并重建我的测试项目

I found out that old version of annotation processor is used for processing annotations, not upgraded one how I expect. 我发现旧版本的注释处理器用于处理注释,而不是我期望的那样升级。 As I figure out changes will be enable if I restart Eclipse but this biheviour is not proper. 据我了解,如果重新启动Eclipse,将启用更改,但是这种情况是不正确的。 Maybe someone helps me to resolve this trouble how I can upgrade annotation processor without restarting Eclipse. 也许有人可以帮助我解决该问题,而无需重新启动Eclipse就可以升级注释处理器。

I've experienced this problem when developing my own custom annotation processor for android project using Eclipse. 使用Eclipse为Android项目开发自己的自定义注释处理器时,我遇到了这个问题。 It seems eclipse cached the jar-lib for your annotation processor (i am not verifying this yet). 看来eclipse为您的注释处理器缓存了jar-lib(我尚未对此进行验证)。 You can try the following steps: 您可以尝试以下步骤:

  1. Remove your jar-lib from eclipse annotation processor path 从eclipse注释处理器路径中删除jar-lib
  2. Clean, rebuild an package your jar-lib 清理,重新构建您的jar-lib包
  3. Add the new jar-lib to your annotation processor path 将新的jar-lib添加到注释处理器路径

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

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