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

nkalmar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c65069  ZOOKEEPER-3423: use the maven-like way to ignore the 
generated version java files and doc the cmd:'./zkServer.sh version'
4c65069 is described below

commit 4c650696fc89b4492b0f14fbbb4b59f5f03775dd
Author: maoling <[email protected]>
AuthorDate: Wed Jun 26 10:35:13 2019 +0200

    ZOOKEEPER-3423: use the maven-like way to ignore the generated version java 
files and doc the cmd:'./zkServer.sh version'
    
    - more details in the[ 
ZOOKEEPER-3423](https://issues.apache.org/jira/browse/ZOOKEEPER-3423)
    
    Author: maoling <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Norbert Kalmar 
<[email protected]>
    
    Closes #980 from maoling/ZOOKEEPER-3423
---
 .gitignore                                                   |  1 -
 build.xml                                                    |  3 +++
 zookeeper-docs/src/main/resources/markdown/zookeeperTools.md |  6 +++++-
 zookeeper-server/pom.xml                                     | 12 ++++++++++++
 .../main/java/org/apache/zookeeper/version/util/VerGen.java  |  6 +++---
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6c3a91d..c3a688e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,7 +88,6 @@ zookeeper-client/zookeeper-client-c/depcomp
 zookeeper-client/zookeeper-client-c/install-sh
 zookeeper-client/zookeeper-client-c/ltmain.sh
 zookeeper-client/zookeeper-client-c/missing
-zookeeper-server/src/main/java/org/apache/zookeeper/version/Info.java
 zookeeper-server/src/test/resources/
 
 # Python
diff --git a/build.xml b/build.xml
index ec504be..29f0602 100644
--- a/build.xml
+++ b/build.xml
@@ -113,6 +113,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
     <property name="build.dir" value="${basedir}/build" />
     <property name="distribution" value="${basedir}/distribution" />
     <property name="src_generated.dir" 
value="${basedir}/zookeeper-jute/target/main/java" />
+    <property name="src_version_generated.dir" 
value="${basedir}/zookeeper-server/target/generated-sources/java" />
     <property name="c.src.dir" 
value="${basedir}/zookeeper-client/zookeeper-client-c" />
     <property name="csrc_generated.dir" value="${c.src.dir}/generated" />
 
@@ -397,6 +398,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
             <arg value="${version}" />
             <arg value="${lastRevision}" />
             <arg value="${build.time}" />
+            <arg value="${src_version_generated.dir}" />
             <classpath>
                 <pathelement path="${build.classes}" />
             </classpath>
@@ -505,6 +507,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
                target="${javac.target}" source="${javac.source}" debug="on" 
encoding="${build.encoding}">
             <src path="${java.server.src.dir}"/>
             <src path="${jute.src.dir}"/>
+            <src path="${src_version_generated.dir}"/>
             <classpath refid="java.classpath"/>
             <compilerarg value="-Xlint:all"/>
             <compilerarg value="-Xlint:-path"/>
diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperTools.md 
b/zookeeper-docs/src/main/resources/markdown/zookeeperTools.md
index 7e28217..5a9f3e1 100644
--- a/zookeeper-docs/src/main/resources/markdown/zookeeperTools.md
+++ b/zookeeper-docs/src/main/resources/markdown/zookeeperTools.md
@@ -36,7 +36,7 @@ limitations under the License.
 A command for the operations for the ZooKeeper server.
 
 ```bash
-Usage: ./zkServer.sh 
{start|start-foreground|stop|restart|status|upgrade|print-cmd}
+Usage: ./zkServer.sh 
{start|start-foreground|stop|version|restart|status|upgrade|print-cmd}
 # start the server
 ./zkServer.sh start
 
@@ -61,6 +61,10 @@ Mode: standalone
 # print the parameters of the start-up
 ./zkServer.sh print-cmd
 
+# show the version of the ZooKeeper server
+./zkServer.sh version
+Apache ZooKeeper, version 3.6.0-SNAPSHOT 06/11/2019 05:39 GMT
+
 ```
 
 <a name="zkCli"></a>
diff --git a/zookeeper-server/pom.xml b/zookeeper-server/pom.xml
index cc18882..125600c 100755
--- a/zookeeper-server/pom.xml
+++ b/zookeeper-server/pom.xml
@@ -191,6 +191,17 @@
               <timeZone>GMT</timeZone>
             </configuration>
           </execution>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                
<source>${project.build.directory}/generated-sources/java</source>
+              </sources>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
       <plugin>
@@ -231,6 +242,7 @@
                 <argument>${project.version}</argument>
                 <argument>${git.commit.id}</argument>
                 <argument>${build.time}</argument>
+                
<argument>${project.basedir}/target/generated-sources/java</argument>
               </arguments>
             </configuration>
           </execution>
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 b84dacd..f843ac9 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
@@ -33,7 +33,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");
+                + "version.util.VerGen maj.min.micro[-qualifier] rev buildDate 
outputDirectory");
         System.exit(ExitCode.UNEXPECTED_ERROR.getValue());
     }
 
@@ -183,7 +183,7 @@ public class VerGen {
      *            </ul>
      */
     public static void main(String[] args) {
-        if (args.length != 3)
+        if (args.length != 4)
             printUsage();
         try {
             Version version = parseVersionString(args[0]);
@@ -198,7 +198,7 @@ public class VerGen {
             } else {
                 rev = rev.trim();
             }
-            generateFile(new File("."), version, rev, args[2]);
+            generateFile(new File(args[3]), version, rev, args[2]);
         } catch (NumberFormatException e) {
             System.err.println(
                     "All version-related parameters must be valid integers!");

Reply via email to