Compilation error for annotations in Java 1.8 and IntelliJ IDEA 14

11,827

You need to configure a separate annotation profile for your module.

  1. Create an annotation profile
    1. In the Annotation Processors page, click add.
    2. In the 'Create new profile' dialog box, specify the profile name.
  2. Associate a module with an annotation profile
    1. Select your module in the list of modules under a default profile. (By default, all the modules of a project are associated with the default profile.)
    2. Click Move to, or press F6.
    3. From the drop-down list, select the target profile to move the selected module to. Annotation profile - move
  3. Configure annotation processing for a profile
    1. Enable annotation processing for the default profile.
    2. Disable annotation processing for the profile, you've just created.

This answer is based on an article from IntelliJ IDEA Help.

Share:
11,827
naXa stands with Ukraine
Author by

naXa stands with Ukraine

#BelarusWithUkraine 🤍❤️🤍 🇺🇦 I focus mostly on java technologies such as spring-framework, android, hibernate, gradle, etc. Employment history: Exadel, ScienceSoft, self-employed. Feel free to consider all code I provide on Stack Overflow licensed under CC0, I would be happy to receive an "honourable mention" or something, but for the code it's optional.

Updated on June 28, 2022

Comments

  • naXa stands with Ukraine
    naXa stands with Ukraine almost 2 years

    I was playing with Java annotation processing. Application build fails in IntelliJ IDEA, while a maven build ends successfully. I am sure that provider class exists, yet I get the following error:

    java: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider <my class> not found.
    

    I suppose that's because of a module X, that should be compiled with -proc:none argument. But I need annotation processing to be enabled for the rest of application. How to configure IntelliJ IDEA build proccess to skip a specific module during annotation proccessing?

  • naXa stands with Ukraine
    naXa stands with Ukraine over 7 years
    @maytham-ɯɐɥʇʎɐɯ IDK. The screenshot is copied from IntelliJ IDEA Help.
  • kriegaex
    kriegaex over 7 years
    Why do you a) answer your own question, b) answer it the very same minute you posted it and c) put a bounty on it more than a year later? I am puzzled.