#!/bin/bash

mvn install:install-file -DgroupId=io.clickhouse -DartifactId=spark-clickhouse-connector_2.12 -Dversion=3.0.0_0.25 -Dpackaging=jar -Dfile=src/main/resources/jars/spark-clickhouse-connector_2.12-3.0.0_0.25.jar

if [ $? -ne 0 ];then
  exit 255
fi

echo "mvn install spark-clickhouse-connector_2.12-3.0.0_0.25.jar"

mvn install:install-file -DgroupId=com.alibaba -DartifactId=taobao-sdk-java-auto -Dversion=1545720399572-20190823 -Dpackaging=jar -Dfile=src/main/resources/jars/taobao-sdk-java-auto_1545720399572-20190823.jar

if [ $? -ne 0 ];then
  exit 255
fi

echo "mvn install taobao-sdk-java-auto_1545720399572-20190823.jar"

mvn install:install-file -DgroupId=com.alibaba -DartifactId=dingtalk-sdk -Dversion=1479188381469-20210727 -Dpackaging=jar -Dfile=src/main/resources/jars/taobao-sdk-java-auto_1479188381469-20210727.jar

if [ $? -ne 0 ];then
  exit 255
fi

echo "mvn install taobao-sdk-java-auto_1479188381469-20210727.jar"


mvn clean compile package || exit 1

mkdir target/zip
cp -r azkaban/* target/zip/
cp target/DMP-*-jar-with-dependencies.jar target/zip/DMP.jar
cd target/zip
zip -r ../dmp.zip ./*
