Springboot reference jar package separate deployment

Maven relies on jar package separation when packaging, pom adds

<!--Copy dependencies to lib-->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy</id>
            <phase>package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>
                    ${project.build.directory}/lib
                </outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

After normal maven is packaged, lib will be added under target, which contains all the dependencies. The jar package only has the code of the project. If there are static files (including jsp) in the java project www.fhadmin.org, they can be placed in the static directory

Server script:

//java project fhadmin.org
#! /bin/sh

MAIN_JAR_NAME="xxx-0.0.1-SNAPSHOT.jar"
MAIN_CLASS="com.dahua.xxxApplication"

PROJECT_HOME=$(cd `dirname $0`; pwd)

cd ${PROJECT_HOME}

PROJECT_LIB=${PROJECT_HOME}/code/lib

PROJECT_CONF=${PROJECT_HOME}/code/conf
PROJECT_JAR=${PROJECT_HOME}/${MAIN_JAR_NAME}

CLASSPATH=.:${PROJECT_CONF}:${PROJECT_JAR}
for i in ${PROJECT_LIB}/*.jar ; do
  CLASSPATH=${CLASSPATH}:${i}
done

DFlag=${MAIN_JAR_NAME}_${MAIN_CLASS}
CUR_SERVICE = `ps -ef | grep $ {DFlag} | grep -v "grep" | awk '{print $ 2}' `
for PID in ${CUR_SERVICE}
do
   kill -9 ${PID}
   echo "End process: ${PID}"
done

nohup java -server -DFlag=${DFlag} -Dfile.encoding=UTF-8 -cp ${CLASSPATH} ${MAIN_CLASS} $@ 1>>nohup.out 2>&1 &


Guess you like

Origin blog.51cto.com/14622073/2542632