diff --git a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java index 0c7146ddb1678..fefb745797092 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java @@ -118,7 +118,7 @@ protected void doExecute() throws MojoExecutionException { // Essentially what this does is to enable the native package type even if a different package type is set // in application properties. This is done to preserve what users expect to happen when // they execute "mvn package -Dnative" even if quarkus.package.type has been set in application.properties - if (!setPackageTypeSystemPropertyIfNativeProfileEnabled()) { + if (setPackageTypeSystemPropertyIfNativeProfileEnabled()) { propertiesToClear.add(PACKAGE_TYPE_PROP); } diff --git a/devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java index e721cf89e80c7..b8b43e94db09b 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java @@ -132,7 +132,9 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException { } catch (Exception any) { throw new MojoExecutionException("Failed to bootstrap Quarkus application", any); } finally { - System.clearProperty(PACKAGE_TYPE_PROP); + if (clearPackageTypeSystemProperty) { + System.clearProperty(PACKAGE_TYPE_PROP); + } Thread.currentThread().setContextClassLoader(originalCl); if (deploymentClassLoader != null) { deploymentClassLoader.close();