STS创建SpringBoot项目

STS -- SpringBoot项目

原文链接:https://blog.csdn.net/qq_41665356/article/details/89182465

一、创建父项目

步骤:

1. new Spring-Stater-Project (下一步直到完成)

(如果出现错误:JSONException: A JSONObject text must begin with '{' at character 0

解决方案:http --> https)

2. 将pom.xml中的<packaging>jar</packaging> 改为: <packaging>pom</packaging>

(如果pom文件报错: maven configuration problem

解决方案:加<properties> <maven-jar-plugin.version>3.0.0</maven-jar-plugin.version> </properties>

备注:如果还是出错,将pom该回jar,没错再改回来)

3.项目右键在java buile path中将source和libraries中的内容都去掉,(buile path ->
configure -> 全选中 -> remove)

二、 创建子项目

1. new Spring-Stater-Project (将Location的值改为: 父项目地址+/父项目名称+/子项目名称)next直到完成

2. 在pom.xml中删除原始的parent标签,添加一段:

<parent>

  <groupId>创建项目时的Group</groupId>

  <artifactId>创建项目时的Artifact</artifactId>

  <version>创建项目时的Version</version>

</parent>

3. 在父项目的pom.xml中添加一段配置:

<modules>

<module>子项目名称</module>

</modules>

4. 同理建第2个第3个子项目也是如此

假设第一个子项目为公用项目,可在其它项目加依赖

<dependency>

<groupId>公用项目Group</groupId>

<artifactId>公用项目名称</artifactId>

<version>公用项目Version</version>

</dependency> 

原文地址:https://www.cnblogs.com/free-discipline/p/12493750.html