多模块项目搭建(IDEA+Maven+SpringBoot)

小结一下,方便扩展整合

1.创建空Maven项目quickx

  Create New Project->Maven->maven-archetye-quickstart->后面常规填写

  项目创建成功后,在pom.xml中 添加

  <packaging>pom</packaging>

 

注意:后面建立的模块都统一使用同一个

  Goup建议统一 如:com.ranx

  Package、Version也建议统一

2.创建一个模块cmstemp

  右键父项目->New->Module->Spring initializr->选中Custom,填入:https://start.spring.io->后面常规填写

(说明:https://start.spring.io 可以快速创建springboot项目)

3.创建个模块专门放工具类 quickx-utils

4.在quickx的pom.xml会有(注意次序)

  <modules>
    <module>quickx-utils</module>
    <module>cmstemp</module>
  </modules>

5.在cmstemp使用quickx-utils中的工具

  添加依赖:
  <dependency>
    <groupId>com.ranx</groupId>
    <artifactId>quickx-utils</artifactId>
    <version>${utils-version}</version>
  </dependency>

6.测试一下

在quickx-utils中建一个工具类,在cmstemp中引用,启动cmstemp的CmstempApplication,启动成功后在浏览器访问

说明:我这里报了错:

  Failed to determine a suitable driver class

     Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

  解决:注释掉cmstemp中的MySQL相关依赖 或者 在yml中配置好数据库项

7.项目结构图

 

展开:

猜你喜欢

转载自www.cnblogs.com/ranx/p/10252958.html