Skip to content

Commit 7c16246

Browse files
Hans-Peter Schmidbvarner
authored andcommitted
issue #72: honour return value of provider.tag()
1 parent a002a6a commit 7c16246

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/e_gineering/maven/gitflowhelper/TagMasterMojo.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.apache.maven.scm.ScmException;
1010
import org.apache.maven.scm.ScmFileSet;
1111
import org.apache.maven.scm.ScmTagParameters;
12+
import org.apache.maven.scm.command.tag.TagScmResult;
1213
import org.apache.maven.scm.provider.ScmProvider;
1314
import org.apache.maven.scm.repository.ScmRepository;
1415

@@ -51,7 +52,15 @@ protected void execute(final GitBranchType type, final String gitBranch, final S
5152
ScmTagParameters tagParams = new ScmTagParameters("Release tag [" + sanitizedTag + "] generated by gitflow-helper-maven-plugin.");
5253
tagParams.setRemoteTagging(true);
5354

54-
provider.tag(repository, new ScmFileSet(project.getBasedir()), sanitizedTag, tagParams);
55+
final TagScmResult tagScmResult = provider.tag(repository, new ScmFileSet(project.getBasedir()), sanitizedTag, tagParams);
56+
if (!tagScmResult.isSuccess()) {
57+
getLog().error("Provider message:");
58+
getLog().error(tagScmResult.getProviderMessage());
59+
getLog().error("Command output:");
60+
getLog().error(tagScmResult.getCommandOutput());
61+
62+
throw new MojoFailureException(tagScmResult.getProviderMessage() );
63+
}
5564
} catch (ScmException scme) {
5665
throw new MojoFailureException("Unable to tag master branch.", scme);
5766
}

0 commit comments

Comments
 (0)