<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${build.file}</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
<excludes>
<exclude>*:servlet-api*</exclude>
<exclude>*:spring-boot-devtools*</exclude>
<exclude>*:service-*</exclude>
</excludes>
</dependencySet>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>modules/</outputDirectory>
<unpack>false</unpack>
<includes>
<include>*:service-*</include>
</includes>
</dependencySet>
</dependencySets>
<moduleSets>
<moduleSet>
<includeSubModules>true</includeSubModules>
</moduleSet>
</moduleSets>
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/script/</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/target/</directory>
<outputDirectory>modules/</outputDirectory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/target/classes/</directory>
<outputDirectory>conf</outputDirectory>
<includes>
<include>*.properties</include>
<include>*.conf</include>
<include>*.json</include>
<include>*.yml</include>
</includes>
</fileSet>
</fileSets>
</assembly>
#!/bin/sh
##########################################################################################
# BOOT SERVER #
##########################################################################################
scriptdir=`dirname $0`
APP_HOME=$scriptdir
APP_CONFIG="conf/application.properties"
APP_PORT="9200"
BOOT_OPTS="--server.port=$APP_PORT"
JAVA_OPTS="-Dfile.encoding=UTF-8 -Xmx1024M -Xms64M -Xss256K -XX:MaxPermSize=256M -XX:+UseParallelGC "
JAVA_HOME_PATH="/home/wxpay/jdk1.8.0_121"
CL_ERR='\e[0;31m'
CL_INFO='\e[0;32m'
CL_WARN='\e[0;33m'
reset='\e[0m'
error() { echo -e "${CL_ERR}ERROR | $1${reset}"; }
info() { echo -e "${CL_INFO}INFO | $1${reset}"; }
warn() { echo -e "${CL_WARN}WARN | $1${reset}"; }
PID_FILE="BOOT_PID"
if [[ -n "$APP_CONFIG" ]]; then
BOOT_OPTS="$BOOT_OPTS --spring.conf.location=$APP_CONFIG"
fi
if [[ -n "$JAVA_HOME" && -x "$JAVA_HOME/bin/java" ]]; then
JAVACMD="$JAVA_HOME/bin/java"
JAVA_HOME_PATH="$JAVA_HOME"
else
if [[ -n "$JAVA_HOME_PATH" && -x "$JAVA_HOME_PATH/bin/java" ]]; then
JAVACMD="$JAVA_HOME_PATH/bin/java"
else
echo "JAVA_HOME not found in your enviroment"
exit 1
fi
fi
SEP=":"
CLASSPATH=""
if [[ -z "$CLASSPATH" ]]; then
for ext in "$APP_HOME"/lib/* ; do
if [[ -z "$CLASSPATH" ]]; then
CLASSPATH="$ext"
else
CLASSPATH="${CLASSPATH}${SEP}${ext}"
fi
done
for ext in "$APP_HOME"/modules/*; do
if [[ -z "$CLASSPATH" ]]; then
CLASSPATH="$ext"
else
CLASSPATH="${CLASSPATH}${SEP}${ext}"
fi
done
fi
checkPort(){
if [[ $# -gt 0 && $1 -gt 0 ]]; then
port_pid=`lsof -i:$1 | grep -v "PID" | awk '{print $2}'`
if [[ $port_pid -gt 0 ]] ;then
return 600
fi
else
return 500
fi
}
run() {
APP_MAINCLASS="com.zwxpay.ServerBootstrap"
if [[ $1 -eq 1 ]]; then
$JAVACMD $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS $BOOT_OPTS
else
pid=`nohup $JAVACMD $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS $BOOT_OPTS >/dev/null 2>&1 & echo $!`
fi
}
debug(){
start 1
}
start() {
port_pid=`lsof -i:$APP_PORT | grep -v "PID" | awk '{print $2}'`
if [[ $port_pid -gt 0 ]] ;then
warn "Port $APP_PORT is used for $port_pid"
exit 0
fi
if [ -f $PID_FILE ]; then
pid=`cat $PID_FILE`
if [ -z "`ps axf | grep -w ${pid} | grep -v grep`" ]; then
run $1
else
warn "$APP_MAINCLASS already started! (pid=$pid)"
exit 0
fi
else
run $1
fi
if [ -z $pid ]; then
error "Failed starting"
exit 3
else
echo $pid > $PID_FILE
info "(pid=$pid) [OK]"
exit 0
fi
}
stop() {
if [ -f $PID_FILE ]; then
pid=`cat $PID_FILE`
if [ -z "`ps axf | grep -w ${pid} | grep -v grep`" ]; then
error "Not running (process dead but pidfile exists)"
exit 1
else
pid=`cat $PID_FILE`
kill -9 $pid 2> /dev/null
rm -f $PID_FILE
info "Stopped [$pid]"
exit 0
fi
else
error "Not running (pid not found)"
exit 3
fi
}
restart() {
if [ -f $PID_FILE ]; then
pid=`cat $PID_FILE`
if [ -z "`ps axf | grep -w ${pid} | grep -v grep`" ]; then
error "Not running (process dead but pidfile exists)"
start 0
exit 0
else
pid=`cat $PID_FILE`
kill -9 $pid 2> /dev/null
rm -f $PID_FILE
info "Stopped [$pid]"
start 0
exit 0
fi
else
error "Not running (pid not found)"
exit 3
fi
}
status() {
if [ -f $PID_FILE ]; then
pid=`cat $PID_FILE`
if [ -z "`ps axf | grep -w ${pid} | grep -v grep`" ]; then
error "Not running (process dead but pidfile exists)"
exit 1
else
info "Running [$pid]"
exit 0
fi
else
error "Not running"
exit 3
fi
}
sysinfo() {
info "System Information:"
info "****************************"
info `head -n 1 /etc/issue`
info `uname -a`
info
info "JAVA_HOME=$JAVA_HOME_PATH"
info `$JAVACMD -version`
info
info "APP_HOME=$APP_HOME"
info "APP_MAINCLASS=$APP_MAINCLASS"
info "****************************"
}
case "$1" in
'start')
start 0
;;
'stop')
stop
;;
'restart')
restart
;;
'status')
status
;;
'info')
sysinfo
;;
'debug')
start 1
;;
*)
echo "Usage: $0 {start|stop|restart|status|info}"
exit 1
esac
Spring boot multiple module 打包
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本系列文章主要索引详情 点击查看 现在我们已经有了一个简单的项目了,我们应该怎么将项目打包,并部署到服务器上呢? ...
- 今天看了很多例子,结果发现目前的系统Spring Boot 1.5.8,只能靠实现 Jackson2ObjectM...
- 配置文件范例 注意:1.注意去除'war'插件;2.Main-Class参数的值须为启动application的c...
- 修改pom.xml文件 修改为 添加Tomcat部署依赖包 增加ServletInitializer初始化类 上面...