maven搭建全后端分离项目


1、新建一个父maven工程 mavenDemo,删除src文件夹,  并修改pom的groupId

com.abc


    org.springframework.boot
    spring-boot-starter-parent
    2.1.6.RELEASE

2、在此maven工程下新建 两个model,  一个server 编写后台代码,  一个front ,放前端代码,在pom中都引入打包插件


    xxxx
    
        
            org.springframework.boot
            spring-boot-maven-plugin
        
    

3、前端打包好的代码应该放在  front工程中 src/main/resource/static 文件夹下

4、server工程pom要引入 front工程的依赖


    com.abc
    front
    1.0-SNAPSHOT



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

5、启动server, 即可访问到front工程的静态文件