当前位置: 首页 > wzjs >正文

湖南做旅游网站东莞疫情最新消息通知

湖南做旅游网站,东莞疫情最新消息通知,苏州 网站建设,安徽设计网站建设一、创建一个父模块 不需要添加什么springweb&#xff0c;创建好之后是这样子的&#xff0c;有这些文件 删掉 .mvn&#xff0c;src&#xff0c;HELP.md&#xff0c;mvnw&#xff0c;mvnw.cmd 最原始的pom.xml <?xml version"1.0" encoding"UTF-8"?&…

一、创建一个父模块

不需要添加什么springweb,创建好之后是这样子的,有这些文件

在这里插入图片描述

删掉 .mvn,src,HELP.md,mvnw,mvnw.cmd

在这里插入图片描述

最原始的pom.xml

<?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><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.4.3</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><name>owntestdemo</name><description>owntestdemo</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>21</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-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>

打开pom.xml,需要删掉<build>标签下面的

    <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>

删掉<parent>标签

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

删掉<name>和<description>标签

    <name>owntestdemo</name><description>owntestdemo</description>

删除<dependencies>标签

    <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies>

标签<dependencyManagement>来管理依赖

    <dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version></dependency></dependencies></dependencyManagement>

在<properties>中添加<spring-boot.version>

<spring-boot.version>3.4.3</spring-boot.version>

添加<packaging>,因为外层只是管理依赖的一个文件

<packaging>pom</packaging>

添加<build>标签

    <build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>${maven.compiler.source}</source><target>${maven.compiler.target}</target><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin></plugins><pluginManagement><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugine</artifactId><version>${spring.boot.version}</version><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></pluginManagement></build>

在<properties>里面添加<maven.compiler.source>、<maven.compiler.source>、<maven.compiler.source>

    <properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.source>17</maven.compiler.target><maven.compiler.source>UTF-8</project.build.sourceEncoding></properties>

最后pom.xml的样子

<?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><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>pom</packaging><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>21</java.version><spring-boot.version>3.4.3</spring-boot.version></properties><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>${maven.compiler.source}</source><target>${maven.compiler.target}</target><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin></plugins><pluginManagement><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugine</artifactId><version>${spring.boot.version}</version><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></pluginManagement></build></project>

二、创建子模块

右击owntestdemo项目文件夹 --> New --> Module

在这里插入图片描述

选择Spring Boot,创建module-common

在这里插入图片描述

点next,spring不用管,也不需要勾选任何springweb等

在这里插入图片描述

删掉 .mvn,.gitignore,HELP.md,mvnw,mvnw.cmd

删除后

在这里插入图片描述

module-common原pom.xml

<?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><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.4.3</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>org.example</groupId><artifactId>module-common</artifactId><version>0.0.1-SNAPSHOT</version><name>module-common</name><description>module-common</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>21</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-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>

修改<parent>标签中的<groupId>标签

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

把子类pom.xml中<parent>标签里面的数值改成父类<project>标签里面的数值

    <groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>pom</packaging>

子类module-common的pom.xml修改后

	<parent><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><relativePath/> <!-- lookup parent from repository --></parent>

删除module-common中pom.xml里的<name>标签和<description>标签

原:

	<groupId>org.example</groupId><artifactId>module-common</artifactId><version>0.0.1-SNAPSHOT</version><name>module-common</name><description>module-common</description>

改后:

	<groupId>org.example</groupId><artifactId>module-common</artifactId><version>0.0.1-SNAPSHOT</version>

删除<build>标签

	<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>

删除<dependencies>标签里面的<dependency>标签

		<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>

在父模块pom.xml中<project>标签下,也就是和<build>等标签同级,添加<modules>标签内容,这个就是模块管理子模块。

    <modules><module>module-common</module></modules>

子模块<dependencies>标签添加<dependency>标签,这个是springweb依赖

        <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>

修改module-common中pom.xml的<parent>标签中的<relativePath>标签,如下

原:

<relativePath/>

改后:

    <parent><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --></parent>

修改<groupId>标签

原:

    <groupId>org.example</groupId>

改后:

    <groupId>org.example.common</groupId><artifactId>module-common</artifactId><version>0.0.1-SNAPSHOT</version>

需要把父模块中的pom.xml中的<dependencyManagement>标签,添加<type>和<scope>标签。指定类型不然就会有问题。

    <dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>

加了<type>和<scope>标签子模块的pom.xml就会出现这个向上的箭头

在这里插入图片描述

如果不加<type>和<scope>标签子模块的pom.xml就不会出现这个向上的箭头,就会有问题。

在子模块pom.xml中添加 spring-boot-starter-test 依赖

    <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId></dependency></dependencies>

最后

owntestdemo父模块的pom.xml

<?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><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>pom</packaging><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>21</java.version><spring-boot.version>3.4.3</spring-boot.version></properties><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>${maven.compiler.source}</source><target>${maven.compiler.target}</target><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin></plugins><pluginManagement><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugine</artifactId><version>${spring.boot.version}</version><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></pluginManagement></build><modules><module>module-common</module></modules></project>

module-common 子模块的pom.xml

<?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><groupId>org.example</groupId><artifactId>owntestdemo</artifactId><version>0.0.1-SNAPSHOT</version><relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --></parent><groupId>org.example.common</groupId><artifactId>module-common</artifactId><version>0.0.1-SNAPSHOT</version><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>21</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId></dependency></dependencies></project>
http://www.dtcms.com/wzjs/338897.html

相关文章:

  • 常州谷歌优化什么是网站seo
  • 浦东建设网站制作遵义网站seo
  • 做网站app的工资高吗手机百度搜索引擎入口
  • 和小学生做的黄色网站新闻头条免费下载安装
  • 网站建设方向课程八零云自助建站免费建站平台
  • 制作公司网站有哪些好处网络营销工具有哪些?
  • 百度收录网站怎么更改关键词seo网站优化流程
  • 深圳建设执业注册中心网站google官网登录入口
  • 如何渗透wordpress的网站济宁百度竞价推广
  • 网站怎么做搜索引擎优化seo的英文全称是
  • 一个网站服务器一年大概多少钱如何网上销售自己的产品
  • 广州市手机网站建设百度推广销售
  • 企业网站搭建程序安仁网络推广
  • 快云服务器怎么做网站最新全国疫情实时大数据
  • 赣州网站建设-赣州做网站怎么推广引流客户
  • 内蒙古生产建设兵团四师三十四团知青网站2023年最新新闻摘抄
  • 做彩票网站需要多少钱收录批量查询
  • 中小企业怎么优化网站汕头百度网站推广
  • 仿58同城网站模板杭州seo推广优化公司
  • 知名商业网站有哪些百度网盘pc网页版入口
  • 帝国网站seo推广平台排名
  • 支付网站建设百度官方网
  • seo网站排名软件荆州百度推广
  • 公司宣传 如何做公司网站指数基金
  • 广州网站建设服务电话短视频运营是做什么的
  • 小语言网站建设贵州萝岗seo整站优化
  • 用vs2010做免费网站模板下载seo关键词排名优化
  • 哪个网站可以哪些企业做哪些产品百度网站提交
  • 域名 利用域名做网站 邮箱今日国内最新新闻
  • 海纳网站建设制作公司网页多少钱