|
34 | 34 | import java.util.Map; |
35 | 35 | import java.util.Map.Entry; |
36 | 36 | import java.util.Properties; |
| 37 | +import java.util.TimeZone; |
37 | 38 |
|
38 | 39 | import org.apache.maven.execution.MavenSession; |
39 | 40 | import org.apache.maven.plugin.MojoExecutionException; |
@@ -610,18 +611,22 @@ public String getRevision() throws MojoExecutionException { |
610 | 611 | try { |
611 | 612 | return this.getScmRevision(); |
612 | 613 | } catch (ScmException e) { |
| 614 | + String warnMessage = "Cannot get the revision information from the scm repository"; |
613 | 615 | if (!StringUtils.isEmpty(revisionOnScmFailure)) { |
614 | | - getLog().warn("Cannot get the revision information from the scm repository, proceeding with " |
615 | | - + "revision of " + revisionOnScmFailure + " : \n" + e.getLocalizedMessage()); |
| 616 | + getLog().warn(warnMessage + ", proceeding with " + "revision of " + revisionOnScmFailure + " : \n" |
| 617 | + + e.getLocalizedMessage()); |
616 | 618 |
|
617 | 619 | setDoCheck(false); |
618 | 620 | setDoUpdate(false); |
619 | 621 |
|
620 | 622 | return revisionOnScmFailure; |
621 | 623 | } |
| 624 | + if (!failTheBuild) { |
| 625 | + getLog().warn(warnMessage, e); |
| 626 | + return ""; |
| 627 | + } |
622 | 628 |
|
623 | | - throw new MojoExecutionException( |
624 | | - "Cannot get the revision information from the scm repository : \n" + e.getLocalizedMessage(), e); |
| 629 | + throw new MojoExecutionException(warnMessage + " : \n" + e.getLocalizedMessage(), e); |
625 | 630 | } |
626 | 631 | } |
627 | 632 |
|
@@ -687,4 +692,8 @@ public void setRevisionOnScmFailure(String revisionOnScmFailure) { |
687 | 692 | public void setShortRevisionLength(int shortRevision) { |
688 | 693 | this.shortRevisionLength = shortRevision; |
689 | 694 | } |
| 695 | + |
| 696 | + public void setFailTheBuild(boolean failTheBuild) { |
| 697 | + this.failTheBuild = failTheBuild; |
| 698 | + } |
690 | 699 | } |
0 commit comments