From 4356bba5a56d57f9427f7547c41b89634c011c1d Mon Sep 17 00:00:00 2001 From: Hans-Peter Schmid Date: Wed, 3 May 2017 06:13:49 +0200 Subject: [PATCH] issue #72: honour return value of provider.tag() --- .../maven/gitflowhelper/TagMasterMojo.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/e_gineering/maven/gitflowhelper/TagMasterMojo.java b/src/main/java/com/e_gineering/maven/gitflowhelper/TagMasterMojo.java index f0a4f21..fc0c158 100644 --- a/src/main/java/com/e_gineering/maven/gitflowhelper/TagMasterMojo.java +++ b/src/main/java/com/e_gineering/maven/gitflowhelper/TagMasterMojo.java @@ -9,6 +9,7 @@ import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFileSet; import org.apache.maven.scm.ScmTagParameters; +import org.apache.maven.scm.command.tag.TagScmResult; import org.apache.maven.scm.provider.ScmProvider; import org.apache.maven.scm.repository.ScmRepository; @@ -51,7 +52,15 @@ protected void execute(final GitBranchType type, final String gitBranch, final S ScmTagParameters tagParams = new ScmTagParameters("Release tag [" + sanitizedTag + "] generated by gitflow-helper-maven-plugin."); tagParams.setRemoteTagging(true); - provider.tag(repository, new ScmFileSet(project.getBasedir()), sanitizedTag, tagParams); + final TagScmResult tagScmResult = provider.tag(repository, new ScmFileSet(project.getBasedir()), sanitizedTag, tagParams); + if (!tagScmResult.isSuccess()) { + getLog().error("Provider message:"); + getLog().error(tagScmResult.getProviderMessage()); + getLog().error("Command output:"); + getLog().error(tagScmResult.getCommandOutput()); + + throw new MojoFailureException(tagScmResult.getProviderMessage() ); + } } catch (ScmException scme) { throw new MojoFailureException("Unable to tag master branch.", scme); }