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

The "Refresh Gradle Project" command does not reload .settings/org.eclipse.jdt.apt.core.prefs #1305

Open
nakamura-to opened this issue May 20, 2024 · 1 comment

Comments

@nakamura-to
Copy link

nakamura-to commented May 20, 2024

Expected Behavior

When the "Refresh Gradle Project" command is executed, the Processor options specified in build.gradle are displayed on the Annotation Processing screen.

Current Behavior

When the "Refresh Gradle Project" command is executed, the Processor options specified in build.gradle are reflected in the .settings/org.eclipse.jdt.apt.core.prefs file, but they are not reflected on the Annotation Processing screen.

Context

I want to use synchronizationTasks to ensure that all settings related to annotation processing are reflected from Gradle to Eclipse.

Steps to Reproduce

  • Create a Gradle Project.
  • Replace the contents of build.gradle with the following:
plugins {
    id 'java-library'
    id 'com.diffplug.eclipse.apt' version '3.44.0'
}

compileJava {
    aptOptions {
        processorArgs = ['myOption' : 'hello']
    }
}

eclipse {
    synchronizationTasks 'cleanEclipse', 'eclipse'
}
  • Execute the "Refresh Gradle Project" command.
  • 0pen the .settings/org.eclipse.jdt.apt.core.prefs file and verify that the processor options specified in build.gradle are reflected in it:
#
#Mon May 20 21:44:34 JST 2024
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
org.eclipse.jdt.apt.reconcileEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
eclipse.preferences.version=1
org.eclipse.jdt.apt.processorOptions/myOption=hello
  • 0pen the Annotation Processing screen.

You will notice that the processorOptions remain empty in the Annotation Processing screen.

Your Environment

  • Eclipse IDE for Java Developers
    • Version: 2024-03 (4.31.0)
    • Build id: 20240307-1437
@oleosterhagen
Copy link
Contributor

In your Gradle script the configuration of the JDT Annotation Processing (APT) is done by the Gradle plugin com.diffplug.eclipse.apt and not Eclipse Buildship. Any problems with this plugin should be reported here: https://github.com/diffplug/goomph/issues

The problem seems to be an unsupported combination of using Buildship (e.g. Refresh Gradle Project) and standalone project generation (cleanEclipse, eclipse).

Using the standalone project generator you could try these steps:

  1. Remove the block eclipse (with synchronizationTasks) from your build.gradle.
  2. Run ./gradlew eclipse
  3. Import the project into Eclipse: File > Import... > General > Existing Projects into Workspace (not Existing Gradle Project)

Now the configured processor option should be shown in the Annotation Processing dialog.

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

No branches or pull requests

2 participants