SpringBoot打包时分离yml、properties、xml配置文件以及依赖包

1.修改pom文件:

lib/
resource/

   src/main/resources
  *.properties
 *.yml
     
 
 org.apache.maven.plugins
 maven-jar-plugin
  
 
 *.**
 */*.xml
 *.properties
 *.yml
 */*.properties
 */*.yml
    
 true
 
  lib/
 
 false
 
 com.htcs.modules.WebApplication
   
  ./resources/
   ${project.build.directory}
  
 
 
 org.apache.maven.plugins
 maven-dependency-plugin
   copy-dependencies
 package
  copy-dependencies
    ${project.build.directory}/lib/
                        
    
 
 
 maven-resources-plugin
   copy-resources
 package
  copy-resources
     src/main/resources
  *.properties
 *.yml
 */*.properties
 */*.properties
    ${project.build.directory}/resources
    
 
 
 org.springframework.boot
 spring-boot-maven-plugin
  
 
  non-exists
 non-exists
   ZIP
 
 true
 ${project.build.directory}
     repackage
   
   
     org.springframework.boot
 spring-boot-maven-plugin
 
  org.apache.maven.plugins
 maven-surefire-plugin
 2.22.2
  true
   

2.执行打包maven命令

mvn package

3.拷贝相应文件到服务器

SpringBoot打包时分离yml、properties、xml配置文件以及依赖包_第1张图片

4.在文件目录下执行运行脚本或命令

nohup java -jar htcsbusiness.jar > ./htcs.log 2>&1 &

你可能感兴趣的:(springboot,pom)