Reputation: 31
I’m trying to start unit testing, but I’m encountering some errors when executing any test:
@QuarkusTest
class AccountResourceTest {
@BeforeEach
void setUp() {
}
@Test
void getUserProfile() {
assertEquals("UserTest", "UserTest");
}
However, when I run this test, I receive the following errors:
java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for backend-account::jar:2024.3.1-SNAPSHOTnull
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:642)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:726)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for backend-account::jar:2024.3.1-SNAPSHOTnull
at io.quarkus.bootstrap.BootstrapAppModelFactory.resolveAppModel(BootstrapAppModelFactory.java:308)
at io.quarkus.bootstrap.app.QuarkusBootstrap.bootstrap(QuarkusBootstrap.java:133)
at io.quarkus.test.junit.AbstractJvmQuarkusTestExtension.createAugmentor(AbstractJvmQuarkusTestExtension.java:190)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:218)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:609)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:659)
... 1 more
Caused by: java.lang.RuntimeException: Failed to create application model resolver for backend-account
at io.quarkus.bootstrap.BootstrapAppModelFactory.getAppModelResolver(BootstrapAppModelFactory.java:165)
at io.quarkus.bootstrap.BootstrapAppModelFactory.resolveAppModel(BootstrapAppModelFactory.java:293)
... 6 more
Caused by: java.lang.RuntimeException: Cannot get declared constructors from class org.apache.maven.profiles.activation.FileProfileActivator
at io.smallrye.beanbag.sisu.Sisu.findConstructor(Sisu.java:874)
at io.smallrye.beanbag.sisu.Sisu.addBeanFromXml(Sisu.java:453)
at io.smallrye.beanbag.sisu.Sisu.addClassLoader(Sisu.java:124)
at io.smallrye.beanbag.maven.MavenFactory.<init>(MavenFactory.java:71)
at io.smallrye.beanbag.maven.MavenFactory.create(MavenFactory.java:96)
at io.smallrye.beanbag.maven.MavenFactory.create(MavenFactory.java:111)
at io.smallrye.beanbag.maven.MavenFactory.create(MavenFactory.java:124)
at io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext.configureMavenFactory(BootstrapMavenContext.java:889)
at io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext.initRepoSystemAndManager(BootstrapMavenContext.java:876)
at io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext.getRepositorySystem(BootstrapMavenContext.java:292)
at io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver.<init>(MavenArtifactResolver.java:114)
at io.quarkus.bootstrap.BootstrapAppModelFactory.getAppModelResolver(BootstrapAppModelFactory.java:161)
... 7 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/plexus/util/interpolation/ValueSource
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3549)
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2727)
at io.smallrye.beanbag.sisu.Sisu.findConstructor(Sisu.java:872)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.util.interpolation.ValueSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 22 more
To give you better insight into my setup, here are the dependencies I'm using
<!-- Testing -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-security</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>${org.wiremock.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jacoco</artifactId>
<scope>test</scope>
</dependency>
What I would like to know is:
Any advice or suggestions would be greatly appreciated. Thank you in advance!
Upvotes: 2
Views: 64
Reputation: 31
The latest version of the plugin, copy-rename-maven-plugin, dates back to 2014, and among its dependencies is the version 1.5.8 of pluxus-utils. However, during the build process, the version of plexus-utils that gets downloaded is not 1.5.8, but rather 3.5.1. The discrepancy in the version of plexus-utils being used can be attributed to Maven's dependency resolution. When multiple versions are present, Maven tends to choose the most recent one, which could result in the use of a newer version of plexus-utils.
Here the closed issue and solution
Upvotes: 0