okbuck icon indicating copy to clipboard operation
okbuck copied to clipboard

Can't figure out how to use okbuck with autovalue on a Java project

Open msridhar opened this issue 6 years ago • 6 comments

Example:

https://github.com/msridhar/okbuck-ep-test/tree/autovalue

Clone the repo and check out the autovalue branch. If you run ./gradlew :module:compileJava, things run fine. But if you try to run ./gradlew :module:okbuck -Dokbuck.wrapper=true you get an error:

Execution failed for task ':module:okbuck'.
> autoValueConfigurations should be present if adding autoValue dependencies. missing: [DefaultExternalModuleDependency{group='com.google.auto.value', name='auto-value', version='1.6.6', configuration='default'}]

I tried copying over the config from the v0.48.2 release notes (see the top-level build.gradle) but that didn't seem to remove the error. Any suggestions on how I can get this working? @kageiit

msridhar avatar Oct 11 '19 03:10 msridhar

@kageiit @raviagarwal7 gentle ping

msridhar avatar Oct 16 '19 00:10 msridhar

you would need to add auto value configuration as well since auto value is being used alone in the project.

okbuck {
    externalDependencies {
        autoValueConfigurations = [
            "autoValue",
            "autoValueAnnotations"
        ]
    }
}

def autoValueDeps = ['com.google.auto.value:auto-value:1.6.6']
def autoValueAnnotationsDeps = autoValueDeps + ['com.google.auto.value:auto-value-annotations:1.6.6']

afterEvaluate {
    dependencies {
         autoValue autoValueDeps
         autoValueAnnotations autoValueAnnotationsDeps
    }
}

raviagarwal7 avatar Oct 16 '19 08:10 raviagarwal7

@raviagarwal7 that’s pretty much what I have in my top level build.gradle:

https://github.com/msridhar/okbuck-ep-test/blob/autovalue/build.gradle

Is there something wrong there?

msridhar avatar Oct 16 '19 16:10 msridhar

Update: when I copy exactly the the config from @raviagarwal7's comment then it works! It would be cool if this were documented somewhere on the wiki, though. Also I'm still not sure why my version didn't work.

msridhar avatar Oct 16 '19 17:10 msridhar

My issue is solved, but I'm leaving this issue open for better docs

msridhar avatar Oct 16 '19 18:10 msridhar

@raviagarwal7 can you please copy over text from https://github.com/uber/okbuck/pull/844 to the wiki as you see fit and close this?

kageiit avatar Jul 17 '20 00:07 kageiit