google / auto

A collection of source code generators for Java.
Apache License 2.0
10.43k stars 1.2k forks source link

Implementing an Extension Results in Error snapshot 1.3 #342

Closed naturalwarren closed 8 years ago

naturalwarren commented 8 years ago

Seeing this when creating an extension. Can anyone help discern what's wrong?

Caused by: java.util.ServiceConfigurationError: com.google.auto.value.extension.AutoValueExtension: Error reading configuration file
    at com.google.auto.value.processor.AutoValueProcessor.applicableExtensions(AutoValueProcessor.java:490)
    at com.google.auto.value.processor.AutoValueProcessor.processType(AutoValueProcessor.java:422)
    at com.google.auto.value.processor.AutoValueProcessor.process(AutoValueProcessor.java:150)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
    at com.sun.tools.javac.main.Main.compile(Main.java:523)
    ... 34 more
Caused by: java.util.zip.ZipException: invalid distance too far back
    ... 45 more
eamonnmcmanus commented 8 years ago

Looks like you have a corrupt jar file. Maybe try cleaning and rebuilding.

naturalwarren commented 8 years ago

Didn't help. Even did a gw clean --refresh-dependencies

naturalwarren commented 8 years ago

Seemed to be an intermittent problem related to my local setup. Had a friend build my branch and it worked for him.

naturalwarren commented 8 years ago

I think this may be related to using Android Studio and a gradle terminal at the same time. Upon closing Android Studio the problem resolved itself.

ZacSweers commented 7 years ago

I'm seeing this again now too, with IntelliJ. Not really sure what the deal is unless the dependency downloader in the IDE is somehow corrupting jars

ZacSweers commented 7 years ago

Specifically, the stacktrace indicates

Caused by: java.io.FileNotFoundException: JAR entry META-INF/services/com.google.auto.value.extension.AutoValueExtension not found in /Users/pandanomic/dev/java/contributing/auto-value-moshi/auto-value-moshi/build/libs/auto-value-moshi-0.4.3-SNAPSHOT.jar

Yet when I dig into that jar, it's there. 100% reproducible on https://github.com/rharter/auto-value-moshi when running ./gradlew compileJava

It seems to work the first time, and then fail forever after. Happens when I do a local maven installation of the artifact as well

cketcham commented 7 years ago

I'm getting this as well. After I stop the gradle daemon it seems to work.

eamonnmcmanus commented 7 years ago

I don't know what to suggest. I don't think there's anything we can do on the AutoValue side.

cketcham commented 7 years ago

@eamonnmcmanus yeah I'm not sure. Just wanted to surface that extra bit of information in case it's useful.

3flex commented 7 years ago

Restarting the Gradle daemon also seemed to fix this (at least temporarily) for me. Pretty annoying but at least we can work around it.

Never seen this issue on any other projects, only now while I'm hacking on auto-value-gson extension.

davidburstromspotify commented 5 years ago

@naturalwarren When you close Android Studio it will forcefully stop all running Gradle daemons, so essentially you had the same workaround as ./gradlew --stop