3
我是新來編寫shell腳本運行在Maven項目類文件,並試圖寫一個小腳本使用下面的腳本在Maven項目運行的類文件:SH - 使用shell腳本
function cleanup() {
kill ${SERVER_PID} ${CLIENT_PID}
rm -f cp.txt
}
trap cleanup EXIT
mvn test dependency:build-classpath -Dmdep.outputFile=cp.txt
CLASSPATH=$(cat cp.txt):target/classes
java -classpath ${CLASSPATH} com.practice.Server &
SERVER_PID=$$
while ! nc localhost 1111 > /dev/null 2>&1 < /dev/null; do
echo "$(date) - waiting for server at localhost:1111..."
sleep 1
done
java -classpath ${CLASSPATH} com.practice.Client
CLIENT_PID=$$
cleanup
但我不斷收到
在本地主機等待服務器:1111
錯誤:
Error: Could not find or load main class com.paractice.Server
注:該sh文件存在於項目文件夾中,即與src和目標文件夾平行。
請幫忙!!!