dev-java/mockito: prevent hamcrest-core on classpath

Avoid a compilation error 'module * reads package org.hamcrest from
both org.hamcrest and hamcrest.core' when junit:5 was compiled with
the 'vintage' USE flag.

Closes: https://bugs.gentoo.org/963753
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Part-of: https://github.com/gentoo/gentoo/pull/44205
Closes: https://github.com/gentoo/gentoo/pull/44205
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
Volkmar W. Pogatzki 2025-10-16 18:58:33 +02:00 committed by Miroslav Šulc
parent dff68b7748
commit 8b24419ee1
No known key found for this signature in database
GPG Key ID: 65D0F770B26B469C

View File

@ -18,6 +18,7 @@ SLOT="0"
KEYWORDS="~amd64"
DEPEND="
>=dev-java/apiguardian-api-1.1.2-r1:0
>=dev-java/asm-9.8-r1:0
>=dev-java/byte-buddy-1.17.7:0
>=dev-java/hamcrest-3.0:0
@ -39,13 +40,14 @@ DEPEND="
# symbol: class var
RDEPEND=">=virtual/jre-11:*"
JAVA_CLASSPATH_EXTRA="asm byte-buddy hamcrest jna jsr305 junit-5 objenesis opentest4j"
JAVA_CLASSPATH_EXTRA="apiguardian-api asm byte-buddy hamcrest jna jsr305 objenesis opentest4j"
JAVA_TEST_SRC_DIR="mockito-core/src/test/java"
src_prepare() {
java-pkg-2_src_prepare
# junit:4 --with-dependencies seems to pull another hamcrest into classpath.
# prevent junit:{4,5} to pull hamcrest-core on classpath
JAVA_GENTOO_CLASSPATH_EXTRA=":$(java-pkg_getjars --build-only junit-4)"
JAVA_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjars --build-only junit-5)"
# dev-java/byte-buddy is built from byte-buddy-dep without shaded stuff.
sed \