Skip to content

Commit

Permalink
Short message notification when project contains only one module.
Browse files Browse the repository at this point in the history
Automatically use short message description because with full message
build time information is duplicated.
  • Loading branch information
jcgay committed Mar 15, 2014
1 parent f7467c5 commit d8f267d
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: ");
Expand Down Expand Up @@ -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]");
Expand Down

0 comments on commit d8f267d

Please sign in to comment.