Error compiling Dagger 2 in Eclipse

Asked

Viewed 47 times

0

I am studying the project example of the official website of Dagger, which can be accessed in this link: https://github.com/google/dagger/tree/master/examples/simple/src/main/java/coffee. I am using the eclipse IDE. When I run the project it gives error on the line where reference is made to the generated Dagger_coffee class. Eclipse is simply not generating this file automatically, as stated in the tutorials. I emphasize that I will not use Dagger in a mobile project, but with Java EE. I know CDI is the most appropriate, but this is a requirement of my boss. What must be wrong? Follow the code:

package coffee;

import dagger.Component;
import javax.inject.Singleton;

public class CoffeeApp {
@Singleton
@Component(modules = { DripCoffeeModule.class })
    public interface Coffee {
        CoffeeMaker maker();
  }

  public static void main(String[] args) {
      Coffee coffee = Dagger_Coffee.builder().build();
      coffee.maker().brew();
  }
}

1 answer

0

Dagger no longer generates classes with "_", so replace Dagger_Coffee for DaggerCoffee and then give a Rebuild in the project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.