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

Upgrading firebase-admin from 9.3 to 9.4 causes JUnit to fail with an error about a shaded Hamcrest class #1017

Closed
fatso83 opened this issue Oct 12, 2024 · 1 comment · Fixed by #1024

Comments

@fatso83
Copy link

fatso83 commented Oct 12, 2024

tldr
the Surefire test runner fails with java.lang.NoClassDefFoundError: shaded_package/org/hamcrest/SelfDescribing after upgrading only firebase-admin from 9.3.0 to 9.4.0. I suspect it might be related to a wrongly scoped dependency (see #1016).

Env info (OS, library versions)

❯ npx -y envinfo  --system

  System:
    OS: macOS 14.7
    CPU: (12) arm64 Apple M2 Max
    Memory: 3.28 GB / 64.00 GB
    Shell: 5.2.37 - /opt/homebrew/bin/bash
  • Operating System version: macOS 14.7
  • Firebase SDK version: N/A
  • Library version: 9.4.0
  • Firebase Product: admin

Steps to reproduce:

I created a minimally reproducible testcase, which can be run like this:

git clone https://github.com/fatso83/issue-reproductions
cd issue-reproductions/noclassdeffound_shaded_package
mvn test

The result is that the Surefire test runner fails with java.lang.NoClassDefFoundError: shaded_package/org/hamcrest/SelfDescribing. The same thing happens if running in IntelliJ. I found that this is caused by me upgrading firebase-admin from version 9.3.0 to 9.4.0. If I change that dependency to 9.3.0 the issue goes away.

Relevant Code:

See above issue. A single unit test class is enough to show the issue.

Suspect: incorrect test dependency

I browsed the repo and found #1016. That is a likely candidate for how this could occur, if it pulls in shaded versions of Junit or Hamcrest.

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants