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

Update Maven usage in README to suggest annotationProcessorPaths #293

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ of your `pom.xml` and the `dagger-compiler` artifact as either an `optional` or
</dependencies>
```

or as an `annotationProcessorPaths` value of the `maven-compiler-plugin`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why we shouldn't just recommend this outright?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • requires maven-compiler-plugin version 3.5+
  • things like mvn dependency:go-offline, mvn versions:display-dependency-updates won't see them (of course, if you use a property for the Dagger version, mvn versions:display-property-updates would see it from the com.google.dagger:dagger standard dependency)
  • doesn't respect dependencyManagement (for managing versions), forcing you to use a property. In other words, you have <version> scattered all over your POMs, rather than centralized in a dependencyManagement; and it prevents you from using BOMs (<scope>import</scope>) to manage versions of your dependencies across projects of your organization (forces you to use a <parent> defining a property for the Dagger version).

(requires at least version 3.5):

```xml
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.x</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.x</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
```

If you use the beta `dagger-producers` extension (which supplies
parallelizable execution graphs), then add this to your maven configuration:

Expand All @@ -80,7 +111,7 @@ parallelizable execution graphs), then add this to your maven configuration:
```groovy
// Add plugin https://plugins.gradle.org/plugin/net.ltgt.apt
plugins {
id "net.ltgt.apt" version "0.5"
id "net.ltgt.apt" version "0.10"
}

// Add Dagger dependencies
Expand Down