This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.6 by this push:
     new 4d1ddef  ZOOKEEPER-3738: Fix VerGen when mvngit.commit.id is null
4d1ddef is described below

commit 4d1ddefe044e5d69783c4cbbc3d25772a152ec72
Author: Christopher Tubbs <[email protected]>
AuthorDate: Wed Apr 15 16:11:41 2020 +0200

    ZOOKEEPER-3738: Fix VerGen when mvngit.commit.id is null
    
    Workaround for exec-maven-plugin treating an empty
    `<argument>${mvngit.commit.id}</argument>` as null and passing an
    incorrect number of arguments to VerGen.
    
    This change allows the revision to be omitted in the command-line args
    to VerGen.
    
    This allows the mavanagaiata-maven-plugin to provide the git commit id,
    when available, to the VerGen command. This change is superseded in
    ZooKeeper 3.7.0 and later by ZOOKEEPER-3786
    (https://github.com/apache/zookeeper/pull/1310), which simplifies
    generating the version information and removes VerGen.
    
    Author: Christopher Tubbs <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko 
<[email protected]>
    
    Closes #1321 from ctubbsii/fix-vergen-for-36-mavanagaiata
---
 .../src/main/java/org/apache/zookeeper/version/util/VerGen.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java 
b/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java
index 9bb699f..6ae97e1 100644
--- 
a/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java
+++ 
b/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java
@@ -35,7 +35,7 @@ public class VerGen {
 
     static void printUsage() {
         System.out.print("Usage:\tjava  -cp <classpath> org.apache.zookeeper."
-                         + "version.util.VerGen maj.min.micro[-qualifier] rev 
buildDate outputDirectory");
+                         + "version.util.VerGen maj.min.micro[-qualifier] 
[rev] buildDate outputDirectory");
         System.exit(ExitCode.UNEXPECTED_ERROR.getValue());
     }
 
@@ -177,9 +177,12 @@ public class VerGen {
      *            </ul>
      */
     public static void main(String[] args) {
-        if (args.length != 4) {
+        if (args.length != 3 && args.length != 4) {
             printUsage();
         }
+        if (args.length == 3) {
+            args = new String[]{args[0], null, args[1], args[2]};
+        }
         try {
             Version version = parseVersionString(args[0]);
             if (version == null) {

Reply via email to