The Auto project has a set of common utilities to help ease use of the annotation processing environment.
Auto common utilities have a standard Maven setup which can also be used from Gradle, Ivy, Ant, or other systems which consume binary artifacts from the central Maven binary artifact repositories.
<dependency> <groupId>com.google.auto</groupId> <artifactId>auto-common</artifactId> <version>1.0-SNAPSHOT</version> <!-- or use a known release version --> </dependency>
Auto Common Utilities is used by a variety of annotation processors in Google and new versions may have breaking changes. Users of auto-common are urged to use shade or jarjar (or something similar) in packaging their processors so that conflicting versions of this library do not adversely interact with each other.
For example, in a Maven build you can repackage
your.processor.shaded.auto.common like this:
<project> <!-- your other config --> <build> <plugins> <plugin> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <excludes> <!-- exclude dependencies you don't want to bundle in your processor --> </excludes> </artifactSet> <relocations> <relocation> <pattern>com.google.auto.common</pattern> <shadedPattern>your.processor.shaded.auto.common</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>