I use the following versions:
I have the following project structure:
pom.xml
|- libraries
|- pom.xml
|- library A
| - pom.xml
|- services
|- pom.xml
|- service B
|- pom.xml
library A
has a service class which is referenced in service B
, thus service B
needs a jandex index in library A
. This configuration is already working: I can start the service properly with quarkus:dev
as well as in docker images. Tests triggered via mvn (locally as well in the CI) are working as well (via mvn clean verify -pl services/service-b -am
)
The jandex configuration:
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.2.3</version>
<executions>
<execution>
<id>make-index</id>
<phase>compile</phase>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>
Anyhow, when starting from a clean project and trying to start the integration tests in service-b
out of IntelliJ, it cannot start any test annotated with @QuarkusTest
. I also see that the jandex.idx
in library A
is not generated.
As soon as I triggered any action that executed the phase compile
for library A
at least once, it's working fine: the jandex.idx file is present.
I tried changing the phase of the jandex plugin as well as adding -am
to maven.config
, but neither approach made IntelliJ build the jandex file during test.
Delegating the build to maven opened another can of worms (maven CI friendly versions with maven-git-versioning-extension
).
Found the following approach which was ok'ish in the end (was automated + didn't add too much time to a test run):
BeforeRunTask
. This run task has to be a maven task with the goal jandex.jandex
.A ready-to-use example: Copy the following file to .run/Template Unit.run.xml
<component name="ProjectRunConfigurationManager">
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/pom.xml" goal="jandex:jandex" />
</method>
</configuration>
</component>
This works also on a partial build/clean project as jandex is only executed for already-built classes.