Hello,
I’m trying to use code from another module in my current module’s tests.
My build.gradle.kts
contains:
api(project(":novaconomy-api"))
Which contains the MarketCategory.java
file with its code.
The test looks like this:
@Test
@DisplayName("Test Market#basePrices")
public void testMarketPrices() {
for (MarketCategory c : MarketCategory.values())
for (String s : c.getItemNames())
Assertions.assertTrue(Novaconomy.basePrices.containsKey(s), "Missing items in " + c.name() + ": Missing '" + s + "'");
}
However, when running ./gradlew test
, this error is reported:
java.lang.NoClassDefFoundError: us/teaminceptus/novaconomy/api/economy/market/MarketCategory
TestNovaconomy > Test Market#basePrices FAILED
java.lang.NoClassDefFoundError at TestNovaconomy.java:13
Caused by: java.lang.ClassNotFoundException at TestNovaconomy.java:13
How can I get gradle to resolve the main sources in api/src/main/java
to be resolved in core/src/test/java
?
Help is appreciated