CalvinKirs commented on code in PR #3462:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3462#discussion_r1027621891


##########
bin/install-plugin.sh:
##########
@@ -20,64 +20,80 @@
 #All are downloaded by default. You can also choose what you need. 
 #You only need to configure the plug-in name in config/plugin_config.
 
+# get seatunnel home
+SEATUNNEL_HOME=$(cd $(dirname $0);cd ../;pwd)
+
 # connector default version is 2.2.0, you can also choose a custom version. 
eg: 2.1.2:  sh install-plugin.sh 2.1.2
 version=2.2.0
 
 if [ -n "$1" ]; then
     version="$1"
 fi
 
-echo "Install SeaTunnel connectors plugins, usage version is $version $1"
+echo "Install SeaTunnel connectors plugins, usage version is ${version}"
 
-if [ ! -d connectors ];
+# create the connectors directory
+if [ ! -d ${SEATUNNEL_HOME}/connectors ];
   then
-      mkdir connectors
+      mkdir ${SEATUNNEL_HOME}/connectors
       echo "create connectors directory"
-fi      
-if [ ! -d connectors/flink-sql ];
+fi
+
+# create the flink-sql connectors directory (for v1)
+if [ ! -d ${SEATUNNEL_HOME}/connectors/flink-sql ];
   then
-      mkdir connectors/flink-sql
+      mkdir ${SEATUNNEL_HOME}/connectors/flink-sql
       echo "create flink-sql connectors directory"
 fi
-if [ ! -d connectors/flink ];
+
+# create the flink connectors directory (for v1)
+if [ ! -d ${SEATUNNEL_HOME}/connectors/flink ];
   then
-      mkdir connectors/flink
+      mkdir ${SEATUNNEL_HOME}/connectors/flink
       echo "create flink connectors directory"
-fi 
-if [ ! -d connectors/spark ];
+fi
+
+# create the spark connectors directory (for v1)
+if [ ! -d ${SEATUNNEL_HOME}/connectors/spark ];
   then
-      mkdir connectors/spark
+      mkdir ${SEATUNNEL_HOME}/connectors/spark
       echo "create spark connectors directory"
-fi 
-if [ ! -d connectors/seatunnel ];
+fi
+
+# create the seatunnel connectors directory (for v2)
+if [ ! -d ${SEATUNNEL_HOME}/connectors/seatunnel ];
   then
-      mkdir connectors/seatunnel
+      mkdir ${SEATUNNEL_HOME}/connectors/seatunnel
       echo "create seatunnel connectors directory"
 fi  
 
 path=flink-sql
 
 while read line; do
-    if  [ ${line:0:1} != "-" ] && [ ${line:0:1} != "#" ]
-       then
-               echo "install connector : " $line
-               ./mvnw dependency:get -DgroupId=org.apache.seatunnel 
-DartifactId=${line} -Dversion=${version} -Ddest=connectors/${path}
-    fi
+    # v1 connectors flink-sql
          if [ "$line" = "--flink-sql-connectors--" ]
-           then 
+           then
                 path=flink-sql
-         fi     
+         fi
+         # v1 connectors flink
          if [ "$line" = "--flink-connectors--" ]
-           then 
+           then
                 path=flink
-         fi            
+         fi
+         # v1 connectors spark
          if [ "$line" = "--spark-connectors--" ]
-           then 
+           then
                 path=spark
-         fi     
+         fi
+         # v2 connectors
          if [ "$line" = "--connectors-v2--" ]
-           then 
+           then
                 path=seatunnel
-         fi     
+         fi
+    if  [ ${line:0:1} != "-" ] && [ ${line:0:1} != "#" ]
+       then
+               echo "install connector : " $line
+               ${SEATUNNEL_HOME}/mvnw dependency:get 
-DgroupId=org.apache.seatunnel -DartifactId=${line} -Dversion=${version} 
-Ddest=connectors/${path}

Review Comment:
   ```suggestion
                        ${SEATUNNEL_HOME}/mvnw dependency:get 
-DgroupId=org.apache.seatunnel -DartifactId=${line} -Dversion=${version} 
-Ddest=${SEATUNNEL_HOME}/connectors/${path}
   ```
   We also need to do this, otherwise the connector installation will still be 
the current directory



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to