栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Windows服务器部署Springboot 多模块项目

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Windows服务器部署Springboot 多模块项目

1. 新建父级项目complete

2.子级项目license 、starter、uploadData

3.maven-compiler-plugin插件详解

4.maven-surefire-plugin

Maven本身并不是一个单元测试框架,Java世界中主流的单元测试框架为JUnit和TestNG。Maven所做的只是在构建执行到特定生命周期阶段的时候,通过插件来执行JUnit或者TestNG的测试用例。这一插件就是maven-surefire-plugin,可以称之为测试运行器(Test Runner),他能很好的兼容JUnit 3、JUnit 4以及TestNG。

5.父级项目pom文件


    4.0.0
    pom
    
        license
        uploadData
        starter
    
    
        org.springframework.boot
        spring-boot-starter-parent
        2.5.5
         
    
    cn.lyu
    complete
    0.0.1-SNAPSHOT
    complete
    The project is complete
    
        1.8
    
    
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
    
        
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    3.8.1
                    
                        1.8
                        1.8
                    
                
            
                org.apache.maven.plugins
                maven-surefire-plugin
                2.22.2
                
                    true    
                
            
        
    



6.子项目,license ,pom文件


    4.0.0







    
        complete
        cn.lyu
        0.0.1-SNAPSHOT
    
    jar
    com.example
    license
    0.0.1-SNAPSHOT
    license
    Demo project for Spring Boot
    
        1.8
    
    
        
            org.springframework.boot
            spring-boot-starter
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        

        
            org.springframework.boot
            spring-boot-starter-web
        

        
        
            de.schlichtherle.truelicense
            truelicense-core
            1.33
        

        
            net.sourceforge.nekohtml
            nekohtml
            1.9.18
        

        
            org.projectlombok
            lombok
        

        
            org.apache.commons
            commons-lang3
            3.7
        

        
            cn.hutool
            hutool-all
            5.0.6
        


    

    
        






            
                org.apache.maven.plugins
                maven-resources-plugin
                2.4.3
            
            
            
                org.apache.maven.plugins
                maven-surefire-plugin
                2.22.2
                
                    true
                
            
        
    




7.子项目,uploadData,pom文件


    4.0.0
    
        complete
        cn.lyu
        0.0.1-SNAPSHOT
    
    jar
    com.lyu
    uploadData
    0.0.1-SNAPSHOT
    uploadData

    Demo project for Spring Boot
    
        1.8
    
    
        
            org.springframework.boot
            spring-boot-starter
        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        

        
            mysql
            mysql-connector-java
        

        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
        
            com.alibaba
            druid
            1.1.14
        
        
        
            log4j
            log4j
            1.2.17
        
        
            org.projectlombok
            lombok
            true
        
        
            mysql
            mysql-connector-java
            8.0.21
        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            1.3.2
        

        
            com.example
            license
            0.0.1-SNAPSHOT
        
    




    
        
            org.apache.maven.plugins
            maven-surefire-plugin
            2.22.2
            
                true
            
        
    





8.starter ,pom文件


    
        complete
        cn.lyu
        0.0.1-SNAPSHOT
    
    4.0.0
    jar
    starter


    
        
            org.springframework.boot
            spring-boot-starter
        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        


        
            com.example
            license
            0.0.1-SNAPSHOT
        

        
            com.lyu
            uploadData
            0.0.1-SNAPSHOT
        
    

    
        
        

            
                org.springframework.boot
                spring-boot-maven-plugin
                2.5.5
                
                    cn.lyu.MyApp
                    ZIP
                

                
                    
                        
                            repackage
                        
                    
                
            

            
                org.apache.maven.plugins
                maven-resources-plugin
                2.4.3
            

        
        
    


9.至此,所有模块之间的依赖关系就搞定了,现在将配置文件合并
server.port=80

#启用优雅关机
server.shutdown=graceful
#缓冲10秒
spring.lifecycle.timeout-per-shutdown-phase=10s

#License相关配置
license.subject=license_demo
license.publicAlias=publicCert
license.storePass=public_password12345
license.licensePath=D:/workspace/gitee/spring-boot2-license/license/license.lic
license.publicKeysStorePath=D:/workspace/gitee/spring-boot2-license/license/publicCerts.keystore

json.class.type=jackson

spring.datasource.url=jdbc:mysql://119.45.61.44:3306/demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
spring.sql.init.username=root
spring.sql.init.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

10.启动类上加上注解@ComponentScan
package cn.lyu;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;


@ComponentScan("com.lyu.demo")
@ComponentScan("com.example")
@SpringBootApplication
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/340418.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号