i heard Dagger 2 from a friend use it in Android. it pretty good!
But i have a crazy idea, i want to try Dagger 2 example in a pure java project build in Maven and use intellij IDEA. But something wrong by Compiler couldn't generate DaggerCoffeeShop class from ConffeeShop Interface like Dagger user guide.
All my example code same as example.
CoffeeShop coffeeShop = DaggerCoffeeShop.builder()
.dripCoffeeModule(new DripCoffeeModule())
.build();
I tried with turn on enable annotation processing
in setting
> compiler
but it not work. I need your help to complete my crazy idea. :(
Use JDK 8. It should support JDK 9, but I did not figure it out how to do it ;)
Be sure to include in POM:
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.11</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>