Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

388
Visualizações
Can't compile project when I'm using Lombok under IntelliJ IDEA

I'm trying to use Lombok in my project that I'm developing using IntelliJ IDEA 11.

I've installed 3rd-party plugin for IDEA and it seems working fine because IDEA sees all autogenerated methods/fields.

So I have a class that uses Slf4j. I annotated it like this

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestClass
{
    public TestClass()
    {
        log.info("Hello!");
    }
}

But when I build my project compiler spits: cannot find symbol variable log.

Could you please tell me what I'm missing here?

Update: It turned out it's RequestFactory annotation process that fails.

input files: {com.zasutki.courierApp.server.TestServlet, com.mine.courierApp.server.model.DatastoreObject}

annotations: [javax.inject.Singleton, javax.inject.Inject, lombok.Getter, lombok.Setter, com.googlecode.objectify.annotation.Id, com.googlecode.objectify.annotation.OnSave]

Processor com.google.web.bindery.requestfactory.apt.RfValidator matches [lombok.Getter, com.googlecode.objectify.annotation.Id, javax.inject.Inject, lombok.Setter, com.googlecode.objectify.annotation.OnSave, javax.inject.Singleton] and returns false.

cannot find symbol variable log

Any ideas on workarounds?

Update2: Perhaps it's not something readers want to hear but I ended up switching to Scala.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I fixed it in IDEA 12 by setting the Enable annotation processing checkbox to:

Settings -> Compiler -> Annotation Processors

For IDEA 2016.2:

Preferences... > Build, Run, Deploy > Compiler > Log Processors

After enabling, run Build -> Rebuild Project to get the annotations recognized and remove any errors.


For IDEA 2019.2.1, depending on how the project is configured, installing the Project Lombok plugin may not be enough. Here's another way to use Project Lombok with IntelliJ IDEA:

  1. Visit https://projectlombok.org/download
  2. Download the JAR file to the project's lib directory (for example, $HOME/dev/java/project/libs ).
  3. Start the IDE.
  4. Click File 🠖 Settings .
  5. Extend Compile, Run, Deploy 🠖 Compiler 🠖 Annotation Processors .
  6. Make sure Enable Annotation Processing is checked.
  7. Make sure that Store generate sources relative to is selected based on the project's module settings (if the module's output directory doesn't work, go back and try the other settings).
  8. Click Apply .
  9. Click Plugins .
  10. Click Marketplace .
  11. Set search field to: lombok
  12. Install Lombok .
  13. Click OK .
  14. Restart the IDE if prompted.
  15. Click File 🠖 Project Structure .
  16. Select Libraries .
  17. Click the + symbol to add a new project library (or press Alt + Insert ).
  18. Select Java .
  19. Set the path to: $HOME/dev/java/project/libs/lombok.jar
  20. Click OK .
  21. Select the modules to apply.
  22. Click OK .
  23. Optionally rename lombok to Project Lombok 1.18.8 .
  24. Click OK .

The project can now import from the lombok package and use Project Lombok annotations (for example, lombok.Setter and lombok.Getter ).

over 4 years ago · Santiago Trujillo Relatório

0

Representación gráfica de cómo resolver este problema.

<dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.20</version>
        <scope>provided</scope>
    </dependency>

over 4 years ago · Santiago Trujillo Relatório

0

Enabling annotation processing will make it work

But if you are on a Mac, make sure you enable annotation processing(tick the checkbox) from both the places available.

1.) Intellij Idea -> Preferences -> Compiler -> Annotation Processors

2.) File -> Other Settings -> Default Settings -> Compiler -> Annotation Processors

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda