gwt-places annotation processor in Eclipse

61 views
Skip to first unread message

Gordan Krešić

unread,
Feb 27, 2021, 5:07:15 AM2/27/21
to GWT Users
Did anyone got Eclipse to invoke annotation processor from gwt-places module
that should generate PlaceHistoryMapper implementations?

I have interface that extends org.gwtproject.place.shared.PlaceHistoryMapper
and is annotated with org.gwtproject.place.shared.WithTokenizers. I'm
creating instances by instancing class with my class name suffixed with "Impl".

However, it seems Eclipse doesn't run annotation processor and consequently
can't find implementation class.

Gradle build works fine.

I even explicitly specified gwt-places-processor.jar in project settings in
Eclipse (Java Compiler -> Annotation Processing -> Factory Path), but folder
where generated files should be placed (.apt_generated) is still empty.

Any ideas?

Sidenote: it seems Eclipse has some issue with annotation processors
classpath, because I had to add auto-common.jar (PlaceHistoryMapperProcessor
is based on BasicAnnotationProcessor from auto-common) on Factory Path, too.

-gkresic.

Michael Conrad

unread,
Feb 27, 2021, 8:38:34 AM2/27/21
to google-we...@googlegroups.com
I think you need to add the "goomph" plugin to your build.gradle, close the project, then run the shell script below, then open the project and do a clean.
  • buildscript {
  • repositories {
  • //...
  • }}
  • dependencies {
//...
  • classpath "com.diffplug.gradle:goomph:3.24.0" //Required for apt processing in Eclipse.
  • }
  • }
apply plugin: 'com.diffplug.eclipse.apt' //Required for apt processing in Eclipse.

The shell script:

#!/bin/bash
  • set -e
  • set -o pipefail
  •  
  • cd "$(dirname "$0")"
  •  
  • rm .settings/org.eclipse.jdt.apt.core.prefs || true
  • rm .settings/org.eclipse.jdt.core.prefs || true
  • ../gradlew eclipseJdtApt
  •  
  • rm .factorypath || true
  • ../gradlew eclipseFactorypath
  •  
  • ../gradlew eclipseJdt


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/0ff5fa68-0de1-f84e-8298-5c6a16c19b64%40steatoda.com.

Thomas Broyer

unread,
Feb 28, 2021, 11:19:39 AM2/28/21
to GWT Users
+1, and if you don't want to impose that plugin to all users (if you're contributing to an open source project for example), try applying it from an init script dropped into your ~/.gradle/init.d/ (add the dependency to the buildscript, and apply the plugin to the project; see https://docs.gradle.org/current/dsl/org.gradle.api.invocation.Gradle.html#org.gradle.api.invocation.Gradle:projectsLoaded(groovy.lang.Closure) as a hint)

Thomas Broyer

unread,
Feb 28, 2021, 11:24:01 AM2/28/21
to GWT Users
Oh, and of course, vote for https://github.com/gradle/gradle/issues/2300 and (more importantly I think) https://github.com/eclipse/buildship/issues/329
(annotation processing in Eclipse has always been a PITA though, you may prefer trying to configure Eclipse to see the generated code from your Gradle build, and run Gradle to re-process annotations; no idea how you'd do that though, I've abandoned Eclipse a long time ago, and this is precisely the reason I stopped maintaining the net.ltgt.apt suite of plugins now that it's no longer needed in IntelliJ IDEA; and why it's now maintained by the Diffplug team)

Gordan Krešić

unread,
Mar 1, 2021, 8:33:16 AM3/1/21
to google-we...@googlegroups.com
Several hours later, after upgrading Gradle and learning something new about
annotation processing in both Gradle and Eclipse, I can confirm that this
plugin successfully configures Eclipse project to properly invoke annotation
processors.

Thanks Michael and Thomas.


On 27. 02. 2021. 14:37, Michael Conrad wrote:
> I think you need to add the "goomph" plugin to your build.gradle, close the
> project, then run the shell script below, then open the project and do a clean.
>
> # buildscript {
> # repositories {
> # //...
> # }}
> # dependencies {
> //...
> # classpath "com.diffplug.gradle:goomph:3.24.0"//Required for apt processing
> in Eclipse.
> # }
> # }
>
> apply plugin:'com.diffplug.eclipse.apt'//Required for apt processing in Eclipse.
>
> The shell script:
>
> #!/bin/bash
>
> # set-e
> # set-o pipefail
> #
> # cd "$(dirname "$0")"
> #
> # rm .settings/org.eclipse.jdt.apt.core.prefs ||true
> # rm .settings/org.eclipse.jdt.core.prefs ||true
> # ../gradlew eclipseJdtApt
> #
> # rm .factorypath ||true
> # ../gradlew eclipseFactorypath
> #
> # ../gradlew eclipseJdt
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
> <https://groups.google.com/d/msgid/google-web-toolkit/0ff5fa68-0de1-f84e-8298-5c6a16c19b64%40steatoda.com>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-tool...@googlegroups.com
> <mailto:google-web-tool...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit/CAFHWztzM_aSvmBC-ZxCapSvYesXHA9wvV-11gV2POdroPuw%3DsA%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-web-toolkit/CAFHWztzM_aSvmBC-ZxCapSvYesXHA9wvV-11gV2POdroPuw%3DsA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages