From 7cde6ebf61ffda4008acfabce08de31203f37e3e Mon Sep 17 00:00:00 2001 From: songanwei Date: Fri, 17 Dec 2021 16:33:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=89=93=E5=8C=85=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=88=86=E5=8C=85):=20=E6=89=93=E5=8C=85=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=88=86=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- novel-admin/pom.xml | 91 +++++++++++++++++-- novel-admin/src/main/build/scripts/readme.txt | 8 ++ novel-admin/src/main/build/scripts/start.sh | 47 ++++++++++ novel-admin/src/main/build/scripts/stop.sh | 33 +++++++ .../src/main/build/scripts/windows-start.bat | 10 ++ .../src/main/resources/logback-spring.xml | 2 +- .../java/com/java2nb/novel/entity/News.java | 6 +- novel-crawl/pom.xml | 73 ++++++++++++++- novel-crawl/src/main/build/scripts/readme.txt | 8 ++ novel-crawl/src/main/build/scripts/start.sh | 47 ++++++++++ novel-crawl/src/main/build/scripts/stop.sh | 33 +++++++ .../src/main/build/scripts/windows-start.bat | 10 ++ .../src/main/resources/logback-boot.xml | 4 +- novel-front/pom.xml | 82 ++++++++++++++++- novel-front/src/main/build/scripts/readme.txt | 8 ++ novel-front/src/main/build/scripts/start.sh | 47 ++++++++++ novel-front/src/main/build/scripts/stop.sh | 33 +++++++ .../src/main/build/scripts/windows-start.bat | 10 ++ .../src/main/resources/logback-boot.xml | 4 +- 19 files changed, 540 insertions(+), 16 deletions(-) create mode 100644 novel-admin/src/main/build/scripts/readme.txt create mode 100644 novel-admin/src/main/build/scripts/start.sh create mode 100644 novel-admin/src/main/build/scripts/stop.sh create mode 100644 novel-admin/src/main/build/scripts/windows-start.bat create mode 100644 novel-crawl/src/main/build/scripts/readme.txt create mode 100644 novel-crawl/src/main/build/scripts/start.sh create mode 100644 novel-crawl/src/main/build/scripts/stop.sh create mode 100644 novel-crawl/src/main/build/scripts/windows-start.bat create mode 100644 novel-front/src/main/build/scripts/readme.txt create mode 100644 novel-front/src/main/build/scripts/start.sh create mode 100644 novel-front/src/main/build/scripts/stop.sh create mode 100644 novel-front/src/main/build/scripts/windows-start.bat diff --git a/novel-admin/pom.xml b/novel-admin/pom.xml index 0fed554..29d0b79 100644 --- a/novel-admin/pom.xml +++ b/novel-admin/pom.xml @@ -224,17 +224,17 @@ - + - - + –> org.springframework.boot spring-boot-maven-plugin + --> + + + + + org.springframework.boot + spring-boot-maven-plugin + + ZIP + + + non-exists + non-exists + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + target/lib + false + false + runtime + + + + + + maven-antrun-plugin + 1.8 + + + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/novel-common/src/main/java/com/java2nb/novel/entity/News.java b/novel-common/src/main/java/com/java2nb/novel/entity/News.java index c555349..437cfba 100644 --- a/novel-common/src/main/java/com/java2nb/novel/entity/News.java +++ b/novel-common/src/main/java/com/java2nb/novel/entity/News.java @@ -1,9 +1,11 @@ package com.java2nb.novel.entity; +import java.io.Serializable; import java.util.Date; import javax.annotation.Generated; -public class News { +public class News implements Serializable { + @Generated("org.mybatis.generator.api.MyBatisGenerator") private Long id; @@ -146,4 +148,4 @@ public class News { public void setContent(String content) { this.content = content == null ? null : content.trim(); } -} \ No newline at end of file +} diff --git a/novel-crawl/pom.xml b/novel-crawl/pom.xml index 10710b9..cb2047d 100644 --- a/novel-crawl/pom.xml +++ b/novel-crawl/pom.xml @@ -32,11 +32,82 @@ + org.springframework.boot spring-boot-maven-plugin + + ZIP + + + non-exists + non-exists + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + target/lib + false + false + runtime + + + + + + maven-antrun-plugin + 1.8 + + + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/novel-crawl/src/main/build/scripts/readme.txt b/novel-crawl/src/main/build/scripts/readme.txt new file mode 100644 index 0000000..a3bab7e --- /dev/null +++ b/novel-crawl/src/main/build/scripts/readme.txt @@ -0,0 +1,8 @@ +1:linux启动环境 +sh start.sh + +3:windows启动环境 +windows-start.bat + +3:linux停止应用 +sh stop.sh diff --git a/novel-crawl/src/main/build/scripts/start.sh b/novel-crawl/src/main/build/scripts/start.sh new file mode 100644 index 0000000..17f0acd --- /dev/null +++ b/novel-crawl/src/main/build/scripts/start.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +ENGINE=novel-crawl.jar +cd ../ + +#部署目路 +DEPLOY_DIR=`pwd` +#获取到当前目录的名称 +SERVER_NAME=`basename $DEPLOY_DIR` + +#应用进程 +PIDS=`ps -ef | grep java | grep "$ENGINE" |awk '{print $2}'` +#设置日志文件的输出目录 +LOGS_DIR=$DEPLOY_DIR/logs +if [ ! -d $LOGS_DIR ]; then + mkdir $LOGS_DIR +fi +#日志 +STDOUT_FILE=$LOGS_DIR/stdout.log +#JAVA 环境配置 +JAVA_OPTS=" -Djava.net.preferIPv4Stack=true -Dlog.home=$LOGS_DIR" + +JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:InitiatingHeapOccupancyPercent=50 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:$LOGS_DIR/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof " +#退出标志 +RETVAL="0" + +if [ -n "$PIDS" ]; then + echo "ERROR: The $SERVER_NAME already started!" + echo "PID: $PIDS" + exit $RETVAL +fi + +nohup java -jar $JAVA_OPTS $JAVA_MEM_OPTS -Dloader.path=conf,lib $ENGINE > $STDOUT_FILE 2>&1 & +COUNT=0 + while [ $COUNT -lt 1 ]; do + echo -e ".\c" + sleep 1 + COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l` + if [ $COUNT -gt 0 ]; then + break + fi + done + + echo "OK!" + PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'` + echo "PID: $PIDS" + echo "STDOUT: $STDOUT_FILE" diff --git a/novel-crawl/src/main/build/scripts/stop.sh b/novel-crawl/src/main/build/scripts/stop.sh new file mode 100644 index 0000000..6cf8aed --- /dev/null +++ b/novel-crawl/src/main/build/scripts/stop.sh @@ -0,0 +1,33 @@ +#!/bin/bash +SERVER_NAME=novel-crawl.jar + +#应用进程 +PIDS=`ps -ef | grep java | grep "$SERVER_NAME" |awk '{print $2}'` +if [ -z "$PIDS" ]; then + echo "ERROR: The $SERVER_NAME does not started!" + exit 1 + fi + + echo -e "Stopping the $SERVER_NAME ...\c" + for PID in $PIDS ; do + kill $PID > /dev/null 2>&1 + done + + COUNT=0 + while [ $COUNT -lt 1 ]; do + echo -e ".\c" + sleep 1 + COUNT=1 + for PID in $PIDS ; do + PID_EXIST=`ps -f -p $PID | grep java` + if [ -n "$PID_EXIST" ]; then + COUNT=0 + break + fi + done + done + + echo "OK!" + echo "PID: $PIDS" + PIDS="" + diff --git a/novel-crawl/src/main/build/scripts/windows-start.bat b/novel-crawl/src/main/build/scripts/windows-start.bat new file mode 100644 index 0000000..90cfdb9 --- /dev/null +++ b/novel-crawl/src/main/build/scripts/windows-start.bat @@ -0,0 +1,10 @@ +@echo off +setlocal enabledelayedexpansion +set JAVA=java + +set OPTS=-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC +set ENGINE=novel-crawl.jar +cd ../ +java -jar %OPTS% -Dloader.path=conf,lib %ENGINE% +pause + diff --git a/novel-crawl/src/main/resources/logback-boot.xml b/novel-crawl/src/main/resources/logback-boot.xml index 6be17f5..05c7c83 100644 --- a/novel-crawl/src/main/resources/logback-boot.xml +++ b/novel-crawl/src/main/resources/logback-boot.xml @@ -57,8 +57,8 @@ - + - \ No newline at end of file + diff --git a/novel-front/pom.xml b/novel-front/pom.xml index 66fa459..610c0e1 100644 --- a/novel-front/pom.xml +++ b/novel-front/pom.xml @@ -87,14 +87,92 @@ + + + + + + + + + org.springframework.boot spring-boot-maven-plugin + + ZIP + + + non-exists + non-exists + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + target/lib + false + false + runtime + + + + + + maven-antrun-plugin + 1.8 + + + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - \ No newline at end of file + diff --git a/novel-front/src/main/build/scripts/readme.txt b/novel-front/src/main/build/scripts/readme.txt new file mode 100644 index 0000000..a3bab7e --- /dev/null +++ b/novel-front/src/main/build/scripts/readme.txt @@ -0,0 +1,8 @@ +1:linux启动环境 +sh start.sh + +3:windows启动环境 +windows-start.bat + +3:linux停止应用 +sh stop.sh diff --git a/novel-front/src/main/build/scripts/start.sh b/novel-front/src/main/build/scripts/start.sh new file mode 100644 index 0000000..58519df --- /dev/null +++ b/novel-front/src/main/build/scripts/start.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +ENGINE=novel-front.jar +cd ../ + +#部署目路 +DEPLOY_DIR=`pwd` +#获取到当前目录的名称 +SERVER_NAME=`basename $DEPLOY_DIR` + +#应用进程 +PIDS=`ps -ef | grep java | grep "$ENGINE" |awk '{print $2}'` +#设置日志文件的输出目录 +LOGS_DIR=$DEPLOY_DIR/logs +if [ ! -d $LOGS_DIR ]; then + mkdir $LOGS_DIR +fi +#日志 +STDOUT_FILE=$LOGS_DIR/stdout.log +#JAVA 环境配置 +JAVA_OPTS=" -Djava.net.preferIPv4Stack=true -Dlog.home=$LOGS_DIR" + +JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:InitiatingHeapOccupancyPercent=50 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:$LOGS_DIR/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof " +#退出标志 +RETVAL="0" + +if [ -n "$PIDS" ]; then + echo "ERROR: The $SERVER_NAME already started!" + echo "PID: $PIDS" + exit $RETVAL +fi + +nohup java -jar $JAVA_OPTS $JAVA_MEM_OPTS -Dloader.path=conf,lib $ENGINE > $STDOUT_FILE 2>&1 & +COUNT=0 + while [ $COUNT -lt 1 ]; do + echo -e ".\c" + sleep 1 + COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l` + if [ $COUNT -gt 0 ]; then + break + fi + done + + echo "OK!" + PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'` + echo "PID: $PIDS" + echo "STDOUT: $STDOUT_FILE" diff --git a/novel-front/src/main/build/scripts/stop.sh b/novel-front/src/main/build/scripts/stop.sh new file mode 100644 index 0000000..06b2e00 --- /dev/null +++ b/novel-front/src/main/build/scripts/stop.sh @@ -0,0 +1,33 @@ +#!/bin/bash +SERVER_NAME=novel-front.jar + +#应用进程 +PIDS=`ps -ef | grep java | grep "$SERVER_NAME" |awk '{print $2}'` +if [ -z "$PIDS" ]; then + echo "ERROR: The $SERVER_NAME does not started!" + exit 1 + fi + + echo -e "Stopping the $SERVER_NAME ...\c" + for PID in $PIDS ; do + kill $PID > /dev/null 2>&1 + done + + COUNT=0 + while [ $COUNT -lt 1 ]; do + echo -e ".\c" + sleep 1 + COUNT=1 + for PID in $PIDS ; do + PID_EXIST=`ps -f -p $PID | grep java` + if [ -n "$PID_EXIST" ]; then + COUNT=0 + break + fi + done + done + + echo "OK!" + echo "PID: $PIDS" + PIDS="" + diff --git a/novel-front/src/main/build/scripts/windows-start.bat b/novel-front/src/main/build/scripts/windows-start.bat new file mode 100644 index 0000000..162cfed --- /dev/null +++ b/novel-front/src/main/build/scripts/windows-start.bat @@ -0,0 +1,10 @@ +@echo off +setlocal enabledelayedexpansion +set JAVA=java + +set OPTS=-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC +set ENGINE=novel-front.jar +cd ../ +java -jar %OPTS% -Dloader.path=conf,lib %ENGINE% +pause + diff --git a/novel-front/src/main/resources/logback-boot.xml b/novel-front/src/main/resources/logback-boot.xml index bc78832..ccc3d13 100644 --- a/novel-front/src/main/resources/logback-boot.xml +++ b/novel-front/src/main/resources/logback-boot.xml @@ -57,8 +57,8 @@ - + - \ No newline at end of file +