Upgrading firebase-admin from 9.3 to 9.4 causes JUnit to fail with an error about a shaded Hamcrest class #1017
Description
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.
Activity