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

Declare versions of test-only dependencies inline instead of in our parent pom. #6660

Closed
wants to merge 1 commit into from

Commits on Jul 31, 2023

  1. Declare versions of test-only dependencies inline instead of in our p…

    …arent pom.
    
    Fixes #6654, I hope? If `guava` and its parent pom don't refer to `mockito-core`, then `guava` should no longer affect which version of `mockito-core` is selected by Gradle. (Really, it "shouldn't" even now, but there's a mismatch between Maven's model and Gradle's that causes it to do so.)
    
    I had initially attempted (in cl/552479838) to declare versions of _all_ our dependencies inline, but that [didn't work](#6657 (comment)): We [really need `dependencyManagement` for Gradle purposes, at least until we specify versions for Gradle explicitly](#6654 (comment)).
    
    It would be nice if we could still declare our dependency versions only once, now by using `properties`. (In fact, my attempt to use `properties` made me notice that our version of the Error Prone _plugin_ is older than our version of the Error Prone _annotations_.) However, if we were to make that change, then we'd lose the ability to update dependencies with `versions-maven-plugin` (`update-properties` + `use-latest-releases`), I assume because the properties are declared in one `pom.xml` and used in another. (It's possible that Dependabot is better about this, but we've had trouble getting it to work with our unusual 2-flavor, Google-repo-source-of-truth setup.) I notice that we have this problem even today with `truth.version`....
    
    Tested:
      ```
      $ mvn dependency:tree -Dverbose -X -U &> /tmp/pre
    
      # made changes
    
      $ mvn dependency:tree -Dverbose -X -U &> /tmp/post
    
      $ strip() { cat "$@" | grep -v -e 'Dependency collection stats' -e 'Downloading from' -e 'Progress' -e 'Using connector' -e 'Using transporter' -e 'Using mirror' -e maven-dependency-plugin -e SUCCESS -e 'Total time' -e 'Finished at' | sed -e 's/ (.*managed from.*)//'; }; vimdiff <(strip /tmp/pre) <(strip /tmp/post)
      ```
    
    RELNOTES=Changed our Maven project to avoid [affecting which version of Mockito our Gradle users see](#6654).
    PiperOrigin-RevId: 552508216
    cpovirk authored and Google Java Core Libraries committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    3a32017 View commit details
    Browse the repository at this point in the history