一, 創建工程,引入依賴

来源:https://www.cnblogs.com/TheMagicalRainbowSea/p/18330272
-Advertisement-
Play Games

一, 創建工程,引入依賴 @目錄一, 創建工程,引入依賴創建工程工程間的關係的建立配置各個工程當中的 pow 配置信息,相關的依賴父工程(也就是總項目工程)的 pow 配置demo-module06-generate 模塊中pow 配置: Mybatis 逆向工程的 pow 配置demo-modul ...


一, 創建工程,引入依賴

@

目錄


創建工程

總的目錄工程:

在這裡插入圖片描述

模塊說明:

工程名 地位 說明
pro06-demo-ssm 父工程 總體管理各個子工程
demo-module01-web 子工程 唯一的 war 包工程
demo-module02-component 子工程 管理項目中的各種組件
demo-module03-entity 子工程 管理項目中的實體類
demo-module04-util 子工程 管理項目中的工具類
demo-module05-environment 子工程 框架環境所需依賴
demo-module06-generate 子工程 Mybatis 逆向工程

註意:只有其中的:demo-module01-web 的打包方式要設置為 war ,同時也要設置 webapp 。其他的模塊都是 jar ,maven 預設打包方式就是 jar 所以可以不用特別設置。

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述
在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

後面的其餘的模塊都是這麼創建的,就不多說明瞭。

工程間的關係的建立

在這裡插入圖片描述

操作:

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

配置各個工程當中的 pow 配置信息,相關的依賴

父工程(也就是總項目工程)的 pow 配置

POM 位置如下:就是總項目工程的 pow.xml 位置

在這裡插入圖片描述

各子工程創建好之後就會有下麵配置,不需要手動編輯:

    <groupId>com.rainbowsea.maven</groupId>
    <artifactId>pro06-demo-ssm</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>demo-module01-web</module>
        <module>demo-module02-component</module>
        <module>demo-module03-entity</module>
        <module>demo-module04-util</module>
        <module>demo-module05-environment</module>
        <module>demo-module06-generate</module>
    </modules>

demo-module06-generate 模塊中pow 配置: Mybatis 逆向工程的 pow 配置

<?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>pro06-demo-ssm</artifactId>
        <groupId>com.rainbowsea.maven</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>demo-module06-generate</artifactId>

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

    <!-- 依賴MyBatis核心包 -->
    <dependencies>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.7</version>
        </dependency>
    </dependencies>

    <!-- 控制Maven在構建過程中相關配置 -->
    <build>

        <!-- 構建過程中用到的插件 -->
        <plugins>

            <!-- 具體插件,逆向工程的操作是以構建過程中插件形式出現的 -->
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.0</version>

                <!-- 插件的依賴 -->
                <dependencies>

                    <!-- 逆向工程的核心依賴 -->
                    <dependency>
                        <groupId>org.mybatis.generator</groupId>
                        <artifactId>mybatis-generator-core</artifactId>
                        <version>1.3.2</version>
                    </dependency>

                    <!-- 資料庫連接池 -->
                    <dependency>
                        <groupId>com.mchange</groupId>
                        <artifactId>c3p0</artifactId>
                        <version>0.9.2</version>
                    </dependency>

                    <!-- MySQL驅動 -->
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>8.0.30</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

在這裡插入圖片描述

在這裡插入圖片描述


demo-module05-environment 模塊中的 pow 配置:環境依賴工程的pow 配置

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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>pro06-demo-ssm</artifactId>
        <groupId>com.rainbowsea.maven</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>demo-module05-environment</artifactId>

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

    <dependencies>
        <!-- SpringMVC -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.3.1</version>
        </dependency>

        <!-- Spring 持久化層所需依賴 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>5.3.1</version>
        </dependency>

        <!-- 日誌 -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>

        <!-- Spring5和Thymeleaf整合包 -->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
            <version>3.0.12.RELEASE</version>
        </dependency>

        <!-- Mybatis 和 Spring 的整合包 -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>2.0.6</version>
        </dependency>

        <!-- Mybatis核心 -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.7</version>
        </dependency>

        <!-- MySQL驅動 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.3</version>
        </dependency>

        <!-- 數據源 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.31</version>
        </dependency>
    </dependencies>
</project>

在這裡插入圖片描述


demo-module04-util 模塊 pow 配置:工具類工程

本項目無需配置

demo-module03-entity 模塊 pow 配置:實體類工程

本項目無需配置

demo-module02-component模塊 pow 配置:組件工程 pow 配置

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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>pro06-demo-ssm</artifactId>
        <groupId>com.rainbowsea.maven</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>demo-module02-component</artifactId>

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

    <dependencies>
        <dependency>
            <groupId>com.rainbowsea.maven</groupId>
            <artifactId>demo-module03-entity</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>com.rainbowsea.maven</groupId>
            <artifactId>demo-module04-util</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>com.rainbowsea.maven</groupId>
            <artifactId>demo-module05-environment</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <!-- ServletAPI -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>

在這裡插入圖片描述

demo-module01-web 模塊 pow 配置:Web 工程 pow 配置

在這裡插入圖片描述

<?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>pro06-demo-ssm</artifactId>
        <groupId>com.rainbowsea.maven</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>demo-module01-web</artifactId>
    <packaging>war</packaging>

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

    <dependencies>
        <dependency>
            <groupId>com.rainbowsea.maven</groupId>
            <artifactId>demo-module02-component</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <!-- junit5 -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.7.0</version>
            <scope>test</scope>
        </dependency>

        <!-- Spring 的測試功能 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

在這裡插入圖片描述


所有各個工程當中的 pow 配置信息,相關依賴配置好後,的 maven 依賴視圖如下:

在這裡插入圖片描述

對應順序上一節內容:✏️✏️✏️

對應順序是下一節內容:✏️✏️✏️


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 題目要求 給定兩個字元串 s 和 t ,編寫一個函數來判斷 t 是否是 s 的字母異位詞。 註意:若 s 和 t 中每個字元出現的次數都相同,則稱 s 和 t 互為字母異位詞。 由於字元在電腦記憶體中是以ASCII碼或Unicode編碼的形式存儲的,我們可以得出'a'在ASCII表中的值是97,'A ...
  • PART1: Java基礎知識概述與Java的下載安裝 1)Java語言概述: ① Java的發展史: 詹姆斯·高斯林(James Gosling) 1977年獲得了加拿大卡爾加里大學電腦科學學士學位,1983年獲得了美國卡內基梅隆大學電腦科學博士學位,畢業後到IBM工作,設計IBM第一代工作站 ...
  • 1、簡述C++中命名空間的作用。 答:避免重覆定義全局變數的問題。 2、定義兩個命名空間A 和 B 分別在A中和B中定義變數value。在main函數中將兩個空間的value列印出來。 #include "iostream" using namespace std; namespace A { in ...
  • 寫在前面 昨天說了一下Java中的數據類型、運算符、選擇語句、迴圈語句部分的基礎知識,今天寫的編程題就是來檢驗這部分的成果,來看看你能寫出來幾題。答案也是僅供參考,如果有更好的解法歡迎在下麵留言! 題目展示 1.輸入自己的名字,年齡和性別,分別用不同的變數接收,並將輸入的信息做輸出。 代碼: pub ...
  • 在氣象學和環境科學的研究中,理解和預測氣象數據的周期性變化至關重要。小波分析作為一種高效的數學工具,近年來在氣象數據的周期性分析中得到了廣泛應用。本文將詳細介紹如何通過Python進行小波分析,以探究氣象數據中的周期性變化。 ...
  • 不管你是做數據分析,還是網路爬蟲,Web 開發、亦或是機器學習,你都離不開要和資料庫打交道,而 MySQL 又是最流行的一種資料庫,這篇文章介紹 Python 操作 MySQL 的5種方式,你可以在實際開發過程中根據實際情況合理選擇。 1、MySQLdb MySQLdb又叫MySQL-python ...
  • Java 的多線程是一種允許在一個程式中同時運行多個線程的技術。每個線程是獨立的執行路徑,可以併發執行,從而提高程式的效率和響應能力。 1. 線程基礎 Java 中的線程可以通過繼承 Thread 類或實現 Runnable 介面來創建和管理。 1.1 繼承 Thread 類 class MyThr ...
  • 背景:之前的項目做讀寫分離的時候用的 MybatisPlus的動態數據做的,很多地方使用的@DS直接指定的讀庫或者寫庫實現的業務;隨著表數據量越來越大,現在打算把比較大的表進行水平拆分,準備使用 ShardingJDBC實現,但是發現兩者配合起來並不是那麼順利,網上大部分文章都是直接把整個Shard ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...