编译时创建的类被示为在的IntelliJ不存在 [英] Compile-time created class is shown as non-existent in IntelliJ

查看:276
本文介绍了编译时创建的类被示为在的IntelliJ不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

激励

我想尝试,如果编译时批注处理适合我的问题。它需要开箱的,没有编译参数等。

I'd like to try if compile-time annotation processing fits my problem. It needs to work out of the box, no compiler arguments etc.

当前状态

我有:


  • 注释

  • 注释处理器

  • 包含这两个.jar和含 FQCN 我在META-INF处理器/服务

  • The annotation
  • An annotation processor
  • A .jar containing both of these and a javax.annotation.processing.Processor file containing the FQCN of my processor in META-INF/services

应该发生什么:


  • 它应该自动检测处理器

  • 这应该处理注释,并创建一个新的类(WiredAnnotated)

  • 我应该能够在编译一步使用这个类(而不是多个阶段)

  • 我wan't编辑接受生成这个类(如 AndroidAnnotations 管理这个以及)

  • It should autodetect the processor
  • It should process the annotation and create a new class (WiredAnnotated)
  • I should be able to use this class in one step of compilation (not multiple phases)
  • I wan't the editor to accept this class is generated (e.g. AndroidAnnotations manages this as well)

什么实际发生的情况:


  • 它会自动检测处理器

  • 它创建了一个新的类(以出/生产/ * /生成/)

  • 我可以使用这个类

    • 源$ C ​​$ C相权

    • 当反它看起来不错过

    我试过:


    • 重新启动的IntelliJ

    • 作废缓存

    • 检查注解处理器的输出

    截图:

    编译时,它作为预期的实际工作。我猜它是与检查错误的目录。

    When compiling, it actually works as expected. I guess it has something to do with inspecting the wrong directories.

    有没有人有我在做什么错误的想法/线索?我错过它可以帮助您帮助我的信息?

    Does anyone have an idea/clue on what I'm doing wrong? Did I miss information which could help you help me?

    由于提前,直到

    推荐答案

    那么,你需要你添加了/生产/ * /生成/ 来的项目源文件夹。因此,将的IntelliJ知道您生成的类。

    Well, you need to add you out/production/*/generated/ to projects source folder. So, IntelliJ will know about your generated classes.

    您可以通过目录上点击右键>标记目录作为源根做到这一点。

    You can make it via Right click on directory > Mark directory as source root.

    项目结构(F4)>模块>源标签>源文件夹应该包含与源$ C ​​$ CS的所有目录,生成的一个inludes。

    Project structure (F4) > Modules > Sources tab > Source folders should contain all directories with your source codes, generated one inludes.

    在机器人有一个在根文件夹目录,但是请注意,它会发出蓝色或绿色的,这意味着它标记为源文件夹中,也可见在项目结构>模块。它包含研究 BuildConfig 清单

    In android there is a gen dir in root folder, but notice, it glows blue or green which means it marked as Source folder, it is also visible in Project structure > Modules. It contains R, BuildConfig and Manifest.

    这篇关于编译时创建的类被示为在的IntelliJ不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆