@echo off

set codepath=D:\phy\1.pnkx\pnkx-admin
set serverip=120.53.247.15
set serveruser=root
set userpwd=phy0316.
set uploadpath=/app/

D:
cd "%codepath%"

echo maven clean start...
"C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\phy\1.pnkx\pnkx-admin -Djansi.passthrough=true -Dmaven.home=E:\maven\apache-maven-3.5.3 -Dclassworlds.conf=E:\maven\apache-maven-3.5.3\bin\m2.conf "-Dmaven.ext.class.path=D:\work\IntelliJ IDEA 2023.2.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\work\IntelliJ IDEA 2023.2.1\lib\idea_rt.jar=65344:D:\work\IntelliJ IDEA 2023.2.1\bin" -Dfile.encoding=UTF-8 -classpath E:\maven\apache-maven-3.5.3\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2023.2.1 -s E:\maven\apache-maven-3.5.3\conf\settings.xml -Dmaven.repo.local=E:\maven\repository clean

echo maven package start...
"C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\phy\1.pnkx\pnkx-admin -Djansi.passthrough=true -Dmaven.home=E:\maven\apache-maven-3.5.3 -Dclassworlds.conf=E:\maven\apache-maven-3.5.3\bin\m2.conf "-Dmaven.ext.class.path=D:\work\IntelliJ IDEA 2023.2.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\work\IntelliJ IDEA 2023.2.1\lib\idea_rt.jar=65360:D:\work\IntelliJ IDEA 2023.2.1\bin" -Dfile.encoding=UTF-8 -classpath E:\maven\apache-maven-3.5.3\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2023.2.1 -s E:\maven\apache-maven-3.5.3\conf\settings.xml -Dmaven.repo.local=E:\maven\repository package
echo maven package finished!


echo upload start...
pscp -l %serveruser% -pw "%userpwd%" "%codepath%\pnkx-admin\target\pnkx-admin.jar"  %serveruser%@%serverip%:%uploadpath%
echo upload finished!


echo update start...
set sshFile=%codepath%\TempSSH.txt
>"%sshFile%" (
  echo,cd %uploadpath%
  echo,sh start.sh restart
)
echo %serverip% update start...
plink -ssh %serveruser%@%serverip% -pw %userpwd% -m %sshFile% -no-antispoof
echo update finished!
pause
