mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
feat(打包改为分包): 打包改为分包
This commit is contained in:
parent
cbfd0b049f
commit
7cde6ebf61
@ -224,17 +224,17 @@
|
|||||||
<!--<scope>provided</scope>-->
|
<!--<scope>provided</scope>-->
|
||||||
<!--</dependency>-->
|
<!--</dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<!-- <build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!--<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>
|
<configuration>
|
||||||
<executable>true</executable>
|
<executable>true</executable>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>-->
|
</plugin>–>
|
||||||
<!--SpringBoot项目默认使用spring-boot-maven-plugin,要打成被其他项目引用的jar包,需要更换此插件-->
|
<!–SpringBoot项目默认使用spring-boot-maven-plugin,要打成被其他项目引用的jar包,需要更换此插件–>
|
||||||
<!-- <plugin>
|
<!– <plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
@ -242,12 +242,91 @@
|
|||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>-->
|
</plugin>–>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
</build>-->
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<!--打包时去除第三方依赖-->
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--拷贝第三方依赖文件到指定目录-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-dependencies</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!--target/lib是依赖jar包的输出目录,根据自己喜好配置-->
|
||||||
|
<outputDirectory>target/lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<!-- 文件夹 -->
|
||||||
|
<copy todir="${project.build.directory}/build/conf" overwrite="true">
|
||||||
|
<fileset dir="${basedir}/src/main/resources">
|
||||||
|
<include name="**/*.*"/>
|
||||||
|
<exclude name="mybatis/*/*.*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<move todir="${project.build.directory}/build/lib">
|
||||||
|
<fileset dir="target/lib"/>
|
||||||
|
</move>
|
||||||
|
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||||
|
tofile="${project.build.directory}/build/${project.artifactId}.jar" />
|
||||||
|
|
||||||
|
<fixcrlf srcdir="${basedir}/src/main/build/scripts" eol="unix"/>
|
||||||
|
<copy todir="${project.build.directory}/build/bin">
|
||||||
|
<fileset dir="${basedir}/src/main/build/scripts">
|
||||||
|
<include name="*.sh" />
|
||||||
|
<include name="*.txt" />
|
||||||
|
<include name="*.bat" />
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
|
||||||
|
<zipfileset filemode="755" dir= '${project.build.directory}/build/' />
|
||||||
|
</zip>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<!--<distributionManagement>
|
<!--<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
8
novel-admin/src/main/build/scripts/readme.txt
Normal file
8
novel-admin/src/main/build/scripts/readme.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
1:linux启动环境
|
||||||
|
sh start.sh
|
||||||
|
|
||||||
|
3:windows启动环境
|
||||||
|
windows-start.bat
|
||||||
|
|
||||||
|
3:linux停止应用
|
||||||
|
sh stop.sh
|
47
novel-admin/src/main/build/scripts/start.sh
Normal file
47
novel-admin/src/main/build/scripts/start.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ENGINE=novel-admin.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"
|
33
novel-admin/src/main/build/scripts/stop.sh
Normal file
33
novel-admin/src/main/build/scripts/stop.sh
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SERVER_NAME=novel-admin.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=""
|
||||||
|
|
10
novel-admin/src/main/build/scripts/windows-start.bat
Normal file
10
novel-admin/src/main/build/scripts/windows-start.bat
Normal file
@ -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-admin.jar
|
||||||
|
cd ../
|
||||||
|
java -jar %OPTS% -Dloader.path=conf,lib %ENGINE%
|
||||||
|
pause
|
||||||
|
|
@ -56,7 +56,7 @@
|
|||||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||||
<logger name="com.java2nb" level="DEBUG">
|
<logger name="com.java2nb" level="DEBUG" additivity="false">
|
||||||
<appender-ref ref="debug" />
|
<appender-ref ref="debug" />
|
||||||
</logger>
|
</logger>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.java2nb.novel.entity;
|
package com.java2nb.novel.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.annotation.Generated;
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
public class News {
|
public class News implements Serializable {
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@ -32,8 +32,79 @@
|
|||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<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>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--拷贝第三方依赖文件到指定目录-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-dependencies</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!--target/lib是依赖jar包的输出目录,根据自己喜好配置-->
|
||||||
|
<outputDirectory>target/lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<!-- 文件夹 -->
|
||||||
|
<copy todir="${project.build.directory}/build/conf" overwrite="true">
|
||||||
|
<fileset dir="${basedir}/src/main/resources">
|
||||||
|
<include name="**/*.*"/>
|
||||||
|
<exclude name="mybatis/*/*.*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<move todir="${project.build.directory}/build/lib">
|
||||||
|
<fileset dir="target/lib"/>
|
||||||
|
</move>
|
||||||
|
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||||
|
tofile="${project.build.directory}/build/${project.artifactId}.jar" />
|
||||||
|
|
||||||
|
<fixcrlf srcdir="${basedir}/src/main/build/scripts" eol="unix"/>
|
||||||
|
<copy todir="${project.build.directory}/build/bin">
|
||||||
|
<fileset dir="${basedir}/src/main/build/scripts">
|
||||||
|
<include name="*.sh" />
|
||||||
|
<include name="*.txt" />
|
||||||
|
<include name="*.bat" />
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
|
||||||
|
<zipfileset filemode="755" dir= '${project.build.directory}/build/' />
|
||||||
|
</zip>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
8
novel-crawl/src/main/build/scripts/readme.txt
Normal file
8
novel-crawl/src/main/build/scripts/readme.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
1:linux启动环境
|
||||||
|
sh start.sh
|
||||||
|
|
||||||
|
3:windows启动环境
|
||||||
|
windows-start.bat
|
||||||
|
|
||||||
|
3:linux停止应用
|
||||||
|
sh stop.sh
|
47
novel-crawl/src/main/build/scripts/start.sh
Normal file
47
novel-crawl/src/main/build/scripts/start.sh
Normal file
@ -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"
|
33
novel-crawl/src/main/build/scripts/stop.sh
Normal file
33
novel-crawl/src/main/build/scripts/stop.sh
Normal file
@ -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=""
|
||||||
|
|
10
novel-crawl/src/main/build/scripts/windows-start.bat
Normal file
10
novel-crawl/src/main/build/scripts/windows-start.bat
Normal file
@ -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
|
||||||
|
|
@ -57,7 +57,7 @@
|
|||||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||||
<logger name="com.java2nb" level="DEBUG">
|
<logger name="com.java2nb" level="DEBUG" additivity="false">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
<appender-ref ref="FILE" />
|
<appender-ref ref="FILE" />
|
||||||
</logger>
|
</logger>
|
||||||
|
@ -87,14 +87,92 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<!-- <build>-->
|
||||||
|
<!-- <plugins>-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||||
|
<!-- </plugin>-->
|
||||||
|
<!-- </plugins>-->
|
||||||
|
<!-- </build>-->
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<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>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--拷贝第三方依赖文件到指定目录-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-dependencies</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!--target/lib是依赖jar包的输出目录,根据自己喜好配置-->
|
||||||
|
<outputDirectory>target/lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<!-- 文件夹 -->
|
||||||
|
<copy todir="${project.build.directory}/build/conf" overwrite="true">
|
||||||
|
<fileset dir="${basedir}/src/main/resources">
|
||||||
|
<include name="**/*.*"/>
|
||||||
|
<exclude name="mybatis/*/*.*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<move todir="${project.build.directory}/build/lib">
|
||||||
|
<fileset dir="target/lib"/>
|
||||||
|
</move>
|
||||||
|
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||||
|
tofile="${project.build.directory}/build/${project.artifactId}.jar" />
|
||||||
|
|
||||||
|
<fixcrlf srcdir="${basedir}/src/main/build/scripts" eol="unix"/>
|
||||||
|
<copy todir="${project.build.directory}/build/bin">
|
||||||
|
<fileset dir="${basedir}/src/main/build/scripts">
|
||||||
|
<include name="*.sh" />
|
||||||
|
<include name="*.txt" />
|
||||||
|
<include name="*.bat" />
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
|
||||||
|
<zipfileset filemode="755" dir= '${project.build.directory}/build/' />
|
||||||
|
</zip>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
8
novel-front/src/main/build/scripts/readme.txt
Normal file
8
novel-front/src/main/build/scripts/readme.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
1:linux启动环境
|
||||||
|
sh start.sh
|
||||||
|
|
||||||
|
3:windows启动环境
|
||||||
|
windows-start.bat
|
||||||
|
|
||||||
|
3:linux停止应用
|
||||||
|
sh stop.sh
|
47
novel-front/src/main/build/scripts/start.sh
Normal file
47
novel-front/src/main/build/scripts/start.sh
Normal file
@ -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"
|
33
novel-front/src/main/build/scripts/stop.sh
Normal file
33
novel-front/src/main/build/scripts/stop.sh
Normal file
@ -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=""
|
||||||
|
|
10
novel-front/src/main/build/scripts/windows-start.bat
Normal file
10
novel-front/src/main/build/scripts/windows-start.bat
Normal file
@ -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
|
||||||
|
|
@ -57,7 +57,7 @@
|
|||||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||||
<logger name="com.java2nb" level="DEBUG">
|
<logger name="com.java2nb" level="DEBUG" additivity="false">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
<appender-ref ref="FILE" />
|
<appender-ref ref="FILE" />
|
||||||
</logger>
|
</logger>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user