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

NoClassDefFoundError in IntelliJ because AutoService has class retention #1032

Closed
netdpb opened this issue Mar 25, 2021 · 2 comments · Fixed by #1046
Closed

NoClassDefFoundError in IntelliJ because AutoService has class retention #1032

netdpb opened this issue Mar 25, 2021 · 2 comments · Fixed by #1046
Assignees
Labels
Component: value P2 type=defect Bug, not working as expected

Comments

@netdpb
Copy link
Member

netdpb commented Mar 25, 2021

Maven projects using AutoValue have to explicitly depend on AutoService as well in order to avoid errors when using IDEs like IntelliJ.

For example see https://github.com/googleapis/java-shared-config/blob/393ba5669675afb44740fdc45c8110feccf0b3b6/pom.xml#L773-L786.

Can we change AutoService's retention back to source? Alternatively, can we change AutoValue's dependency on AutoService to have the normal compile scope instead of provided?

@netdpb netdpb added type=defect Bug, not working as expected Component: value P3 labels Mar 25, 2021
@cpovirk
Copy link
Member

cpovirk commented Mar 25, 2021

I am always happy to see annotation deps promoted from provided to compile :)

Our dependency on auto-service...

<scope>provided</scope>

...may well just predate our current advice to use annotationProcessorPaths plus a dep on auto-service-annotations. (Maybe auto-service-annotations didn't even exist as a separate package back then?)

@eamonnmcmanus eamonnmcmanus self-assigned this Mar 25, 2021
@netdpb netdpb added P2 and removed P3 labels Mar 25, 2021
@imtdeepak
Copy link

We also faced the same issue and had to set the annotation processor in Intellij to obtain processors from the project classpath whenever we want to run or debug.

copybara-service bot pushed a commit that referenced this issue Apr 6, 2021
…rPaths>`.

The annotation dependencies for `@AutoService` and for Error Prone are now regular compile-scoped dependencies. This prevents errors from overeager consumers that can't deal with missing annotation class files.

The `<annotationProcessorPaths>` incantations are kind of clunky since we need a different path for building tests (which must include AutoValueProcessor) and for building AutoValue itself (which obviously can't).

Fixes #1032.

RELNOTES=n/a
PiperOrigin-RevId: 367002319
copybara-service bot pushed a commit that referenced this issue Apr 6, 2021
…rPaths>`.

The annotation dependencies for `@AutoService` and for Error Prone are now regular compile-scoped dependencies. This prevents errors from overeager consumers that can't deal with missing annotation class files.

The `<annotationProcessorPaths>` incantations are kind of clunky since we need a different path for building tests (which must include AutoValueProcessor) and for building AutoValue itself (which obviously can't).

Fixes #1032.

RELNOTES=n/a
PiperOrigin-RevId: 367002319
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: value P2 type=defect Bug, not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants