From 690244bdf81355dbe88820311837e3f5ee26512c Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Tue, 15 Aug 2023 08:49:37 +0200 Subject: [PATCH] Fix package type system property clearing --- devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java | 2 +- .../main/java/io/quarkus/maven/TrackConfigChangesMojo.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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();