Java教程

千峰商城-springboot项目搭建-01-创建Maven聚合工程

本文主要是介绍千峰商城-springboot项目搭建-01-创建Maven聚合工程,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

     common  vo,View,Object,utils  帮助类

     beans      po                                     持久化对象

     mapper   dao                                   数据访问

     service                                             业务处理

      api                                                   接口,接收前端请求 

ajax↑↓GoodsVO

 

1.构建父工程

创建一个新的maven项目。

 

 

 

在pom.xml中添加:<packaging>pom</packaging>

 

在父工程中新建一个子工程:maven项目common。

在父工程中新建一个子工程:maven项目beans。

在父工程中新建一个子工程:maven项目mapper。

在父工程中新建一个子工程:maven项目service。

在父工程中新建一个子工程:springboot项目api。

 

 

 

修改pom文件。

 

pom.xml( fmmall ):

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.qfedu</groupId>
    <artifactId>fmmall</artifactId>
    <version>2.0.1</version>
    <modules>
        <module>common</module>
        <module>beans</module>
        <module>mapper</module>
        <module>service</module>
        <module>api</module>
    </modules>
    <packaging>pom</packaging>


    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </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>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

 

 

pom.xml( beans ):

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fmmall</artifactId>
        <groupId>com.qfedu</groupId>
        <version>2.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>beans</artifactId>
  <packaging>jar</packaging>


    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

 

 

pom.xml( common ):

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fmmall</artifactId>
        <groupId>com.qfedu</groupId>
        <version>2.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>common</artifactId>
    <packaging>jar</packaging>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

 

 

pom.xml( mapper ):

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fmmall</artifactId>
        <groupId>com.qfedu</groupId>
        <version>2.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>mapper</artifactId>
    <packaging>jar</packaging>
    
    <dependencies>
        <dependency>
            <groupId>com.qfedu</groupId>
            <artifactId>beans</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

 

 

pom.xml( service ):

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fmmall</artifactId>
        <groupId>com.qfedu</groupId>
        <version>2.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>service</artifactId>
    <packaging>jar</packaging>
    
    <dependencies>
        <dependency>
            <groupId>com.qfedu</groupId>
            <artifactId>mapper</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.qfedu</groupId>
            <artifactId>common</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>

 

 

pom.xml( api ):


<?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>

    <parent>
        <artifactId>fmmall</artifactId>
        <groupId>com.qfedu</groupId>
        <version>2.0.1</version>
    </parent>

    <artifactId>api</artifactId>
    
    <dependencies>
        <dependency>
            <groupId>com.qfedu</groupId>
            <artifactId>service</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>


</project>

 

 

 

 

 

这篇关于千峰商城-springboot项目搭建-01-创建Maven聚合工程的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!