From 26324f68b9965e53314f769d92feef9263beff02 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 5 Oct 2015 11:33:04 +0100 Subject: [PATCH] Make system props available when building model for CLI dep mgmt bom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certain Maven profile activator’s require access to System properties to determine whether or not a profile should be activated. JdkVersionProfileActivator is one such activator. Prior to this commit, the presence of a Maven profile that was activated based on the JDK in a bom imported using @DependencyManagementBom in the CLI would trigger a failure as the JdkVersionProfileActivator could not determine the version of Java on which it was running. This commit updates the CLI to pass the JVM’s System properties to the request to build a bom’s model so that those system properties can be used by JdkVersionProfileActivator (and any other activators which need them). --- .../boot/cli/compiler/DependencyManagementBomTransformation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java index 83c30ee687..5e9d5d7603 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java @@ -170,6 +170,7 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans DefaultModelBuildingRequest request = new DefaultModelBuildingRequest(); request.setModelResolver(new GrapeModelResolver()); request.setModelSource(new UrlModelSource(uri.toURL())); + request.setSystemProperties(System.getProperties()); Model model = modelBuilder.build(request).getEffectiveModel(); this.resolutionContext .addDependencyManagement(new MavenModelDependencyManagement(model));