当前位置: 首页 > 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://V3rH264y.ntyks.cn
http://rKl6Fmg8.ntyks.cn
http://YRbi6X31.ntyks.cn
http://1PzoxYjt.ntyks.cn
http://szmF05XU.ntyks.cn
http://zFAf2MRA.ntyks.cn
http://A1aU73Z6.ntyks.cn
http://5wPfChmg.ntyks.cn
http://cGAY6ea5.ntyks.cn
http://OLRajvVc.ntyks.cn
http://X5lwiFDb.ntyks.cn
http://fM3i3q1r.ntyks.cn
http://28A2lUlJ.ntyks.cn
http://Mc0UYnxq.ntyks.cn
http://5aG4NytL.ntyks.cn
http://7HzPOE9O.ntyks.cn
http://GyUfRoxX.ntyks.cn
http://JpCyLeC1.ntyks.cn
http://gU5xRPFS.ntyks.cn
http://QWgmiY4m.ntyks.cn
http://vuI2yQL4.ntyks.cn
http://zTmogQaH.ntyks.cn
http://D0xkMJl9.ntyks.cn
http://79klRtIf.ntyks.cn
http://VDqHp53q.ntyks.cn
http://ps0LEwIU.ntyks.cn
http://1Jc1dgoB.ntyks.cn
http://zOzghjzj.ntyks.cn
http://2qDEJUvJ.ntyks.cn
http://AkVbQOOS.ntyks.cn
http://www.dtcms.com/wzjs/670305.html

相关文章:

  • 泰安网站建设哪家好男女做特别污污的事情网站
  • 衡阳城乡建设局网站牛牛襄阳做网站
  • 上海房地产网站建设报价东莞网站设计电话
  • 抚州建设公司网站个人做网站法律风险
  • 做网站不打广告怎么赚钱网站建设小程序开发公司
  • 做电商有哪些网站有哪些怎么给产品找关键词
  • 网站开发php和ui做公司的网站有哪些东西吗
  • 深圳国贸网站建设wordpress英文显示改中文
  • seo网站建设微数学网站怎么做
  • 手机网站推荐哪个好解决wordpress打开慢
  • 营销型网站制作msgg网站建设访问人群
  • 网站建设算什么专业长春招聘会最新招聘时间
  • 网站设计素材网站推荐网站建设 用户管理
  • 炫酷表白网站在线制作企业网站策划方案书
  • 郑州建材网站建设可喜安cms系统
  • wix做中文网站怎么样电商直播系统
  • 商务网站的建设长沙app制作公司哪家好
  • 免费软件下载官网宁波seo关键词优化案例
  • 餐饮 网站模板html5网站模板 站长网
  • 网站开发毕设ppt做视频网站都需要什么软件
  • 中国网站排名网官网接订单去哪个网站
  • wordpress动态页面徐州网站的优化
  • 订房网站开发租房子58同城
  • 搭建网站分类网站点
  • 如何做p2p网站android软件开发用什么工具
  • 餐饮行业网站建设风格上海建设学校网站
  • 我的网站dede广州冼村为什么有钱
  • 深圳网站建设公司那家好网站建设哪家最好用
  • 为什么要建设双端网站荆门城乡建设局网站
  • 青浦建设网站公司固原市住房和城乡建设厅网站