diff --git a/src/main/java/com/github/jcgay/maven/notifier/AbstractCustomEventSpy.java b/src/main/java/com/github/jcgay/maven/notifier/AbstractCustomEventSpy.java index 77caeba..527c546 100644 --- a/src/main/java/com/github/jcgay/maven/notifier/AbstractCustomEventSpy.java +++ b/src/main/java/com/github/jcgay/maven/notifier/AbstractCustomEventSpy.java @@ -58,12 +58,20 @@ protected Status getBuildStatus(MavenExecutionResult result) { } protected String buildNotificationMessage(MavenExecutionResult result) { - if (configuration.isShortDescription()) { + if (shouldBuildShortDescription(result)) { return buildShortDescription(result); } return buildFullDescription(result); } + private boolean shouldBuildShortDescription(MavenExecutionResult result) { + return configuration.isShortDescription() || hasOnlyOneModule(result); + } + + private boolean hasOnlyOneModule(MavenExecutionResult result) { + return result.getTopologicallySortedProjects().size() == 1; + } + protected String buildShortDescription(MavenExecutionResult result) { if (getBuildStatus(result) == Status.SUCCESS) { StringBuilder builder = new StringBuilder("Built in: "); @@ -95,7 +103,7 @@ private String buildFullDescription(MavenExecutionResult result) { protected String buildTitle(MavenExecutionResult result) { StringBuilder builder = new StringBuilder().append(result.getProject().getName()); - if (!configuration.isShortDescription()) { + if (!shouldBuildShortDescription(result)) { builder.append(" [") .append(stopwatch.elapsedTime(TimeUnit.SECONDS)) .append("s]");