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

Documentation should prefer specifying annotation processor paths #773

Closed
netdpb opened this issue Oct 8, 2019 · 5 comments · Fixed by #779
Closed

Documentation should prefer specifying annotation processor paths #773

netdpb opened this issue Oct 8, 2019 · 5 comments · Fixed by #779
Assignees
Labels
Component: * P3 type=documentation Documentation that is other than for an API

Comments

@netdpb
Copy link
Member

netdpb commented Oct 8, 2019

https://github.com/google/auto/blob/master/value/userguide/index.md#in-pomxml first suggests to use <provided>true</provided> on the Maven dependency, and then suggests configuring <annotationProcessorPaths> as an alternative.

We should switch the priority of those (for all artifacts). Using <provided>true</provided> puts the annotation processor and its dependencies on the compile-time and runtime classpath, and could lead to linkage errors at runtime (e.g., googleapis/java-core#46).

@cpovirk
Copy link
Member

cpovirk commented Oct 9, 2019

Coincidentally, I updated the AutoService docs in this way just a few days ago. My immediate motivation there was an additional advantage of using the annotation-processor path: As soon as you set one annotation-processor path in your project (for example, for Error Prone, even though that's a plugin rather than a true(?) annotation processor), javac requires you to do them all that way. (It's also nice to be able to avoid optional/provided for the annotations artifact, at which point you're stuck adding separate entries for the annotations and the processor, so you might as well do it "right" :))

@netdpb
Copy link
Member Author

netdpb commented Oct 9, 2019

Can we just do the same thing for all the auto* projects?

@cpovirk
Copy link
Member

cpovirk commented Oct 9, 2019

I think we should. I'm not sure that AutoFactory has separate annotation and processor artifacts yet, so that would be step 1 for it.

@netdpb
Copy link
Member Author

netdpb commented Oct 9, 2019

OK, so this issue can cover that whole effort.

@netdpb netdpb self-assigned this Oct 16, 2019
kluever pushed a commit that referenced this issue Oct 17, 2019
…auto-value for Maven and Gradle.

Fixes #773.

RELNOTES=Document that `<annotationProcessorPaths>` is the preferred way to use auto-value for Maven and Gradle.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=275036598
@kluever kluever mentioned this issue Oct 17, 2019
kluever pushed a commit that referenced this issue Oct 17, 2019
…auto-value for Maven and Gradle.

Fixes #773.

RELNOTES=Document that `<annotationProcessorPaths>` is the preferred way to use auto-value for Maven and Gradle.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=275036598
@cpovirk
Copy link
Member

cpovirk commented Oct 24, 2019

Also, filed GoogleCloudPlatform/cloud-opensource-java#986 to see if it's worth recommending this pattern in our best practices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: * P3 type=documentation Documentation that is other than for an API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants