zoukankan      html  css  js  c++  java
  • SpringBoot maven 多模块项目搭建

    File -> New -> Project -> Spring Initializer->next

    File -> New -Module -> Maven

     可以直接在parent这个模块上,右键,new->module,这样创建的模块默认以这个parent为父模块,创建完之后如下:

     pom文件内容如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <packaging>pom</packaging>
        <modules>
            <module>springboot-common</module>
            <module>springboot-core</module>
            <module>springboot-service</module>
            <module>springboot-web</module>
        </modules>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.2</version>
            <relativePath/>
        </parent>
        <groupId>com.springboot.multimodule</groupId>
        <artifactId>springboot-maven-multi</artifactId>
        <version>0.0.1-SNAPSHOT</version>
       
        <properties>
            <java.version>1.8</java.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!--optional true,该依赖不会传递 -->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>
  • 相关阅读:
    你的项目中使用过哪些JSTL标签?
    什么是CDN?哪些是流行的jQuery CDN?使用CDN有什么好处?
    MVC的各个部分都有那些技术来实现?如何实现?
    request.getAttribute()和 request.getParameter()有何区别?
    JS中如何将页面重定向到另一个页面?
    比较 SpringSecurity 和 Shiro?
    shiro有哪些组件?
    Apache Shiro 的三大核心组件?
    springmvc和struts2有哪些区别?
    解耦使用的设计模式:
  • 原文地址:https://www.cnblogs.com/yb38156/p/15771944.html
Copyright © 2011-2022 走看看