sebastiandaschner blog


Using the Quarkus dev mode for non-Quarkus projects (Video)

#productivity #testing #quarkus friday, june 18, 2021

The Quarkus dev mode increases our development productivity and especially reduces the turnaround times how long it takes to get test feedback. For Quarkus projects, this is a huge benefit. However, with some hacky workarounds, it’s possible to run the tests of a plain Java project also in a similar way.

In this video, I’m showing how to add the Quarkus Maven plugin to non-Quarkus projects:

 

 

You can check out the system project in Quarkus version 2.15.2.Final on GitHub.

In the system test project, I’ve added the following pom.xml snippet:

<profiles>
  <profile>
    <id>test</id>
    <properties>
      <quarkus.version>2.15.2.Final</quarkus.version>
      <debug>false</debug>
      <quarkus.native.builder-image>ignored</quarkus.native.builder-image>
    </properties>
    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-bom</artifactId>
          <version>${quarkus.version}</version>
          <type>pom</type>
          <scope>import</scope>
        </dependency>
      </dependencies>
    </dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-core</artifactId>
      </dependency>
    </dependencies>
    <build>
      <plugins>
        <plugin>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-maven-plugin</artifactId>
          <extensions>true</extensions>
          <version>${quarkus.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>build</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

In this way, we have to activate the test Maven profile when executing the Quarkus plugin:

mvn quarkus:dev -Ptest

 

Update 2023-01-10: Updated project and required dependency management for Quarkus 2.15

 

Do you want to learn more about modern development with Quarkus and effective testing? Then have a look at my upcoming online workshops in April.