Closed Daniil-Ivanov1 closed 5 months ago
Could you share a sample project for this issue?
@jdneo This code belongs to my company. I can implement the approximate logic and send it to you
@jdneo Example here: https://github.com/Daniil-Ivanov1/ClassNotFoundException
I run mvn clean test
at the root, but failed
Is the packaging type of the module model
meant to be pom
?
@jdneo Hi! I found a legitimate problem! In our project in pom.xml dependencies have a "classifier" set Which is why the test does not find classes
I see. classifier is not well supported now.
See: https://github.com/microsoft/vscode-java-test/issues/775 & https://github.com/redhat-developer/vscode-java/issues/1031
@jdneo Hi! I found a workaround. I think it's worth publishing this. It is necessary to duplicate dependencies. If one has the classifier tag, then add the same dependency next to it without the tag
Hello everyone When trying to run SpringBootTest, it crashes with an error that it cannot find the @Autowired fields, although everything works in IDEA . The project structure looks like this:
public interface TestData {
void setUser(); void setScenario();
}
@SpringBootTest(classes = {AbstractTestConfiguration.BaseConfiguration.class}) @Slf4j @EmbeddedKafka public abstract class AbstractTestConfiguration implements TestData {
@BeforeAll public static void startPostgres() { ... }
@Autowired protected SomeField someFIeld;
@Autowired private SomeJpaRespository someJpaRepostitory;
@Test public void testContextStarted() { ... }
}
public class SomeTestClass extends AbstractTestConfigiuration {
implements setters from interface
}
NoClassDefFoundError: SomeJpaRespositore
Using: Mac OS Sonome 14.4.1 Temurin JDK 17 Red Hat Language Support v1.31.0 Test Runner For Java v0.41.1 maven 3.9.5