Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated classes are not in the classpath in IntelliJ #41

Open
sargunv opened this issue Jun 1, 2016 · 5 comments
Open

Generated classes are not in the classpath in IntelliJ #41

sargunv opened this issue Jun 1, 2016 · 5 comments

Comments

@sargunv
Copy link

sargunv commented Jun 1, 2016

Generated classes don't show up in the classpath in IntelliJ, causing "Cannot resolve symbol" errors. See this sample project: https://github.com/sargunster/annotations where the project builds in Kobalt but shows compile errors in IntelliJ.

One possible solution is to mark the kobaltBuild/classes as a "generated sources root".

@cbeust
Copy link
Owner

cbeust commented Jun 1, 2016

You need to take a few extra steps to declare your annotation processor to IDEA, I don't think this has anything to do with Kobalt.

And I don't think the Kobalt IDEA plug-in can do much since, as you saw, there is no mention of apt in your Build.kt, so the plug-in has no way of knowing you're using an annotation processor (short of doing a lot of costly introspection).

Here is the relevant doc.

@sargunv
Copy link
Author

sargunv commented Jun 1, 2016

Thanks, I'll have a look at the doc. The Gradle plugin doesn't require any additional configuration for annotation processing.

@cbeust
Copy link
Owner

cbeust commented Jun 1, 2016

Ok let's dig a bit further, then. The Kobalt plug-in could see if the project contains any annotation processor file under META-INF and configure the IDE automatically.

@dmitry-zhuravlev Thoughts?

@sargunv
Copy link
Author

sargunv commented Jun 1, 2016

I think the simplest solution is to mark the outputDir in apt as a generated sources root.

@dmitry-zhuravlev
Copy link
Collaborator

I think the simplest solution is to mark the outputDir in apt as a generated sources root.

Agree, but in this case information about defined outputDir should comes from server because plugin should know the actual outputDir defined in Build.kt

@cbeust Also I noticed that if no outputDir defined in Build.kt Kobalt produce generated sources in classes folder:
image

I think that this should be placed in "kobaltBuild/generated/source/apt" just to not mix "java" and "class" files in same place. @cbeust What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants