Commit 29860117 authored by 赵啸非's avatar 赵啸非

修改打包脚本

parent 54120250
Pipeline #2494 canceled with stages
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>target/bin</directory>
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</directory>
<outputDirectory>boot</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>./db</directory>
<includes>
<include>*.sql</include>
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${project.artifactId}-${project.version}.jar</source>
<outputDirectory>boot</outputDirectory>
</file>
</files>
</assembly>
\ No newline at end of file
...@@ -212,11 +212,6 @@ ...@@ -212,11 +212,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</outputDirectory>
<layout>ZIP</layout>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
...@@ -240,10 +235,36 @@ ...@@ -240,10 +235,36 @@
</goals> </goals>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</outputDirectory> <outputDirectory>target/bin
</outputDirectory>
<resources> <resources>
<resource> <resource>
<directory>src/main/bin/</directory> <directory>src/main/bin/</directory>
<excludes>
<exclude>deploy.sh</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-deploy</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}/
</outputDirectory>
<resources>
<resource>
<directory>src/main/bin</directory>
<includes>
<include>deploy.sh</include>
</includes>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
</resources> </resources>
...@@ -251,6 +272,29 @@ ...@@ -251,6 +272,29 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -40,13 +40,6 @@ clear_deploy() { ...@@ -40,13 +40,6 @@ clear_deploy() {
rm -rf ${EXECPATH} rm -rf ${EXECPATH}
} }
#清理ui
clear_ui_deploy() {
EXEC_UI_PATH=$1
rm -rf ${EXEC_UI_PATH}
mkdir -p ${EXEC_UI_PATH}
}
build_service() { build_service() {
SERVICE=$1 SERVICE=$1
EXECPATH=$2 EXECPATH=$2
...@@ -81,6 +74,7 @@ start_service() { ...@@ -81,6 +74,7 @@ start_service() {
#部署后台服务 #部署后台服务
project_deploy() { project_deploy() {
writelog "${PROJECT_NAME}_deploy" writelog "${PROJECT_NAME}_deploy"
systemctl stop ${PROJECT_NAME}
clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH} clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
writelog "${PROJECT_NAME}_clear_finish" writelog "${PROJECT_NAME}_clear_finish"
tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH} tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
...@@ -89,21 +83,11 @@ project_deploy() { ...@@ -89,21 +83,11 @@ project_deploy() {
writelog "${PROJECT_NAME}_deploy_finish" writelog "${PROJECT_NAME}_deploy_finish"
} }
#部署前台服务
project_ui_deploy() {
writelog "${PROJECT_NAME}_ui_deploy"
clear_ui_deploy ${PROJECT_UI_EXECPATH}
tar -zvxf ./${PROJECT_UI_FILENAME} -C ${PUBLISH_PATH}
writelog "${PROJECT_NAME}_ui_deploy_finish"
}
#主函数 #主函数
main() { main() {
echo "后台服务部署" echo "后台服务部署"
project_deploy project_deploy
echo "前端服务部署"
project_ui_deploy
exit ${RETVAL} exit ${RETVAL}
} }
......
...@@ -28,6 +28,7 @@ set JVM_CONFIG=%JVM_CONFIG% -Dapp.name=%PROJECT_NAME% ...@@ -28,6 +28,7 @@ set JVM_CONFIG=%JVM_CONFIG% -Dapp.name=%PROJECT_NAME%
set JVM_CONFIG=%JVM_CONFIG% -Dapp.port=%PORT% set JVM_CONFIG=%JVM_CONFIG% -Dapp.port=%PORT%
set JVM_CONFIG=%JVM_CONFIG% -Djava.io.tmpdir=%TEMP_PATH% set JVM_CONFIG=%JVM_CONFIG% -Djava.io.tmpdir=%TEMP_PATH%
set JVM_CONFIG=%JVM_CONFIG% -Dbasedir=%BASEDIR% set JVM_CONFIG=%JVM_CONFIG% -Dbasedir=%BASEDIR%
set JVM_CONFIG=%JVM_CONFIG% -Dloader.path=file://%BASEDIR%/conf,file://%BASEDIR%/lib
set DEBUG_OPTS= set DEBUG_OPTS=
......
...@@ -32,9 +32,8 @@ if [ -z "$JAVACMD" ] ; then ...@@ -32,9 +32,8 @@ if [ -z "$JAVACMD" ] ; then
JAVACMD="$JAVA_HOME/bin/java" JAVACMD="$JAVA_HOME/bin/java"
fi fi
else else
JAVACMD=`which java > /dev/null 2>&1` JAVACMD=`which java`
echo "Error: JAVA_HOME is not defined correctly." echo "Error: JAVA_HOME is $JAVACMD"
exit $ERR_NO_JAVA
fi fi
fi fi
...@@ -61,7 +60,7 @@ exec "$JAVACMD" $JAVA_OPTS \ ...@@ -61,7 +60,7 @@ exec "$JAVACMD" $JAVA_OPTS \
-Dbasedir="$BASEDIR" \ -Dbasedir="$BASEDIR" \
-Djava.io.tmpdir=$TEMP_PATH \ -Djava.io.tmpdir=$TEMP_PATH \
-Dloader.path="file://$BASEDIR/conf,file://$BASEDIR/lib" \ -Dloader.path="file://$BASEDIR/conf,file://$BASEDIR/lib" \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15501 \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5516 \
-jar $MAIN_CLASS \ -jar $MAIN_CLASS \
> /dev/null & > /dev/null &
......
#! /bin/sh
PORT="@profiles.server.port@"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
echo "stoping application $PROJECT_NAME......"
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME is not started or has been stopped!"
else
curl -X POST -i -u $SECURITY_USERNAME:$SECURITY_PASSWORD http://127.0.0.1:$PORT/xxx_manager/shutdown
for i in {1..60}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -15 $jcpid
for i in {1..30}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
fi
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -9 $jcpid
[ $? -eq 0 ] && echo "Stop $PROJECT_NAME OK!" || echo "Stop $PROJECT_NAME Fail!"
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment