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

mck pushed a commit to branch cassandra-4.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-4.0 by this push:
     new aaffb3b  Fixed broken classpath when multiple jars in build directory
aaffb3b is described below

commit aaffb3b53ef85b1d06c3e4371230208d46effad6
Author: Jacek Lewandowski <[email protected]>
AuthorDate: Tue Nov 9 09:42:27 2021 +0100

    Fixed broken classpath when multiple jars in build directory
    
    Patch by Jacek Lewandowski reviewed by Michael Semb Wever and Brandon 
Williams for CASSANDRA-17129
---
 CHANGES.txt         |  1 +
 bin/cassandra.in.sh | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 1d72c0f..fb9dfaf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0.2
+ * Fixed broken classpath when multiple jars in build directory 
(CASSANDRA-17129)
  * DebuggableThreadPoolExecutor does not propagate client warnings 
(CASSANDRA-17072)
  * internode_send_buff_size_in_bytes and internode_recv_buff_size_in_bytes 
have new names. Backward compatibility with the old names added 
(CASSANDRA-17141)
  * Remove unused configuration parameters from cassandra.yaml (CASSANDRA-17132)
diff --git a/bin/cassandra.in.sh b/bin/cassandra.in.sh
index 5d13cda..dcbd12d 100644
--- a/bin/cassandra.in.sh
+++ b/bin/cassandra.in.sh
@@ -30,10 +30,17 @@ CLASSPATH="$CASSANDRA_CONF"
 # compiled classes. NOTE: This isn't needed by the startup script,
 # it's just used here in constructing the classpath.
 if [ -d $CASSANDRA_HOME/build ] ; then
-    #cassandra_bin="$CASSANDRA_HOME/build/classes/main"
-    cassandra_bin=`ls -1 $CASSANDRA_HOME/build/apache-cassandra*.jar`
+    jars_cnt="`ls -1 $CASSANDRA_HOME/build/apache-cassandra*.jar | grep -v 
'javadoc.jar' | grep -v 'sources.jar' | wc -l | xargs echo`"
+    if [ "$jars_cnt" -gt 1 ]; then
+        dir="`cd $CASSANDRA_HOME/build; pwd`"
+        echo "There are JAR artifacts for multiple versions in the $dir 
directory. Please clean the project with 'ant realclean' and build it again." 
1>&2
+        exit 1
+    fi
 
-    CLASSPATH="$CLASSPATH:$cassandra_bin"
+    if [ "$jars_cnt" = "1" ]; then
+        cassandra_bin="`ls -1 $CASSANDRA_HOME/build/apache-cassandra*.jar | 
grep -v javadoc | grep -v sources`"
+        CLASSPATH="$CLASSPATH:$cassandra_bin"
+    fi
 fi
 
 # the default location for commitlogs, sstables, and saved caches

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to