Skip to content

Commit 7e8c5f5

Browse files
committed
Silence CLI dependency resolution progress reporting when run with -q
Closes gh-7247
1 parent cecc1c8 commit 7e8c5f5

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public class SpringApplicationRunner {
7373
this.compiler = new GroovyCompiler(configuration);
7474
int level = configuration.getLogLevel().intValue();
7575
if (level <= Level.FINER.intValue()) {
76-
System.setProperty("groovy.grape.report.downloads", "true");
76+
System.setProperty(
77+
"org.springframework.boot.cli.compiler.grape.ProgressReporter",
78+
"detail");
7779
System.setProperty("trace", "true");
7880
}
7981
else if (level <= Level.FINE.intValue()) {
@@ -82,6 +84,9 @@ else if (level <= Level.FINE.intValue()) {
8284
else if (level == Level.OFF.intValue()) {
8385
System.setProperty("spring.main.banner-mode", "OFF");
8486
System.setProperty("logging.level.ROOT", "OFF");
87+
System.setProperty(
88+
"org.springframework.boot.cli.compiler.grape.ProgressReporter",
89+
"none");
8590
}
8691
}
8792

spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,10 +93,25 @@ public AetherGrapeEngine(GroovyClassLoader classLoader,
9393
}
9494

9595
private ProgressReporter getProgressReporter(DefaultRepositorySystemSession session) {
96-
if (Boolean.getBoolean("groovy.grape.report.downloads")) {
96+
String progressReporter = System.getProperty(
97+
"org.springframework.boot.cli.compiler.grape.ProgressReporter");
98+
if ("detail".equals(progressReporter)
99+
|| Boolean.getBoolean("groovy.grape.report.downloads")) {
97100
return new DetailedProgressReporter(session, System.out);
98101
}
99-
return new SummaryProgressReporter(session, System.out);
102+
else if ("none".equals(progressReporter)) {
103+
return new ProgressReporter() {
104+
105+
@Override
106+
public void finished() {
107+
108+
}
109+
110+
};
111+
}
112+
else {
113+
return new SummaryProgressReporter(session, System.out);
114+
}
100115
}
101116

102117
@Override
@@ -340,4 +355,5 @@ public Object grab(String endorsedModule) {
340355
throw new UnsupportedOperationException(
341356
"Grabbing an endorsed module is not supported");
342357
}
358+
343359
}

0 commit comments

Comments
 (0)