-
Notifications
You must be signed in to change notification settings - Fork 174
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
Annotation Processor configuration from Gradle Eclipse Plugin #329
Comments
It seems that there will be (some) support for annotation processors if Gradle 4.6 (gradle/gradle#4217) |
gradle/gradle#4217 has nothing to do with the eclipse plugin. Please follow gradle/gradle#2300 for progress on modelling annotation processor configuration better |
I'm started looking into the possibilities of how to implement this feature. The first thing I'd like to check if we can advise people to apply the |
Not the |
Well, I wouldn't advise people to use an unmaintained plugin… (and by unmaintained, I mean that I archived the project on Github and have absolutely no willingness to maintain it any further; I have zero incentive to begin with: I've been using IntelliJ IDEA exclusively for the past 5 years or so, as do my teammates, and it now imports Gradle projects without any specific configuration) Feel free to copy code from the plugin into Buildship and/or Gradle though (it's Apache licensed after all). |
I just stumbled upon this issue while now having to use a annotationprocessor. Seems I have to give the |
For now I ended up with a different solution:
In short this groovy-code covers the usecase of not having a .factorypath file as well as having one with entrys of kind other than 'EXTJAR'. Existing EXTJAR entrys are considered from an earlier refresh-gradle so they are getting cleaned and recreated if still configured in gradle. Entrys other thaen EXTJAR are kept.
Now a "refresh-gradle" on a project (re-)generates the .factorypath withdependency linked from the local gradle-cache. All the other settings like code-gen directory and other settings necessary are in configurationfiles we have under source control anyway. In fact the .factorypath is under versioncontrol as well but had the problem of referencing the jar in an abolut path with the username inside (gradle cache). |
I've just been bitten by this in a project which uses Lombok. |
@pedrolamarao Even if BuildShip supported APT config, that wouldn't help you in this case. Lombok Eclipse integration doesn't use APT. Instead Lombok support uses a Java Agent which you have to install and attach to your Eclipse. The agent modifies Eclipse JDT compiler and tooling. The point is, this is something you install separately yourself and has nothing to do with Eclipse APT. So, while I do think having BuildShip support APT configs, in general, would be good. In this particular case, its not going to help you and you don't need it. Just install Lombok support for Eclipse. See: https://projectlombok.org/setup/eclipse |
As far as I know, Lombok jar is both: Annotation processor and JavaAgent for Eclipse. |
It is an annotation processor sure, if you run it from command line using javac (or indirectly using javac via gradle or maven or whatnot). But to get Eclipse tooling to properly understand your lombok code and so not pester you with lots of invalid compilation errors etc... you need the JavaAgent installed. This modifies Eclipse compiler and tooling to understand lombok. So... even if BuildShip would somehow configure the APT to run the annotation processor it still wouldn't really help with Eclipse integration for lombok. That is my understanding anyway. But I could be wrong. Edit: Also on the flip side. If you install the javagent support for lombok today, even without any support from BuildShip to configure APT, lombok works fine in Eclipse Gradle projects. |
As far as I know, Eclipse can use generated classes when configured properly (and this is what I believe this issue is about). |
Well, I would challenge you to try and do that. Configure Eclipse APT so that it runs the lombok annotation processors. Yes, this is totally possible. But I think you'll find that you cannot actually make Eclipse JDT tooling work properly with the compiled classes and lombok annotated sources at the same time. The problem is that you cannot have Eclipse be aware of both the source code of your 'lombokked' java code and your compiled code at the same time. This would mean that you have two different versions of the same classes on your classpath at the same time. I could be wrong of course but I don't think you can just make lombok integrate nicely with Eclipse simply by telling it to run the annotation processors and configuring build paths. I am however 100% sure that you can already have decent lombok support without any of this if you just install the lombok Java agent. Anyway there's no need to discuss this further. This issue, as has been said is about adding APT integration to BuildShip. That is something I fully support. All I am trying to say here is that Lombok integration won't benefit from this and isn't a 'use case' for this. I only spoke up about that because it seems people have a misunderstanding about it here. |
Original post: https://bugs.eclipse.org/bugs/show_bug.cgi?id=480066
The text was updated successfully, but these errors were encountered: