今天在部署项目到服务器时 启动脚本的时候发现老是报 jar中没有主清单属性
仔细检查了下发现:是缺少了这个依赖
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
添加上之后就正常了。
另外在windows和linux下启动jar包服务的方式是 java -jar XXXXXXXXXXXXXXXXXXX.jar
start.sh 脚本
#!/bin/sh
running()
{
if [ -f "$1" ]
then
local PID=$(cat "$1" 2>/dev/null) || return 1
kill -0 "$PID" 2>/dev/null
return
fi
rm -f "$1"
return 1
}
PIDFILE=JAVAPID
if running "$PIDFILE"
then
pid=`head -1 $PIDFILE`
echo Aready Running "$pid"
exit 1
fi
export JAVA_HOME=/home/dyyt/jdk1.8.0_131
export PATH=$JAVA_HOME/bin:$PATH
JAVA_OPTIONS="${JAVA_OPTIONS} -server -Xms128m -Xmx256m -Xmn128m -Xss256k -XX:PermSize=32m -XX:MaxPermSize=32m"
JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC"
JAVA_OPTIONS="${JAVA_OPTIONS} -verbose:gc -Xloggc:./logs/server_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
echo ${JAVA_OPTIONS}
nohup java ${JAVA_OPTIONS} -jar pbsimu-opcontest-0.0.1-SNAPSHOT.jar -XX:+HeapDumpOnOutOfMemoryError-Dio.netty.leakDetectionLevel=advanced >logs/server.out 2>&1 &
rm -f "$PIDFILE"
echo $! > "$PIDFILE"
tail -F logs/server.out
stop.sh 脚本
#!/bin/sh
running()
{
if [ -f "$1" ]
then
local PID=$(cat "$1" 2>/dev/null) || return 1
kill -0 "$PID" 2>/dev/null
return
fi
rm -f "$1"
return 1
}
PIDFILE=JAVAPID
if running "$PIDFILE"
then
pid=`head -1 $PIDFILE`
echo pid=$pid
echo killing "$pid"
kill $pid
rm -f $PIDFILE
exit 0
else
if [ -f "$PIDFILE" ]
then
pid=`head -1 $JAVAPID`
rm -f $PIDFILE
echo $pid does not exist
else
echo pid file does not exist
fi
fi