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

Day54(24)-F:\硕士阶段\Java\课程代码\后端\web-ai-code\web-ai-project03

Maven高级

分模块设计与开发

image-20251203120514543

image-20251203120906651

image-20251203123822297

继承与聚合

image-20251203124504034

image-20251203124934537

<packaging>pom</packaging>
<!--父工程--><parent><groupId>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../tlias-parent/pom.xml</relativePath></parent>
<?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"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.5.7</version>
<!--        父工程pom.xml的相对路径-->
<!--        如果无配置且自闭和,代表将会从本地仓库中查找,如果找不到就从中央仓库中查找--><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><packaging>pom</packaging><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId><version>3.5.7</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.42</version><optional>true</optional></dependency></dependencies></project>
<?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"><modelVersion>4.0.0</modelVersion><!--父工程--><parent><groupId>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../tlias-parent/pom.xml</relativePath></parent><groupId>com.itheima</groupId><artifactId>tlias-utils</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- 阿里云OSS的依赖--><dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>3.17.4</version></dependency><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>2.3.1</version></dependency><dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>1.1.1</version></dependency><!-- no more than 2.3.3--><dependency><groupId>org.glassfish.jaxb</groupId><artifactId>jaxb-runtime</artifactId><version>2.3.3</version></dependency><!-- JWT令牌的依赖--><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-api</artifactId><version>0.12.5</version></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-impl</artifactId><version>0.12.5</version><scope>runtime</scope></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-jackson</artifactId><version>0.12.5</version><scope>runtime</scope></dependency></dependencies>
</project>
<?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"><modelVersion>4.0.0</modelVersion>
<!--父工程--><parent><groupId>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../tlias-parent/pom.xml</relativePath></parent><!--    <groupId>com.itheima</groupId>--><artifactId>tlias-pojo</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties></project>
<?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>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../tlias-parent/pom.xml</relativePath></parent><!--    <groupId>com.itheima</groupId>--><artifactId>tlias-web-management</artifactId><version>0.0.1-SNAPSHOT</version><name>tlias-web-management</name><description>tlias-web-management</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>17</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>3.0.5</version></dependency><dependency><groupId>com.mysql</groupId><artifactId>mysql-connector-j</artifactId><scope>runtime</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter-test</artifactId><version>3.0.5</version><scope>test</scope></dependency><!--分页插件PageHelper--><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.4.7</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency>
<!--        tlias-pojo实体类--><dependency><groupId>com.itheima</groupId><artifactId>tlias-pojo</artifactId><version>1.0-SNAPSHOT</version></dependency><!--        tlias-utils工具类--><dependency><groupId>com.itheima</groupId><artifactId>tlias-utils</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><annotationProcessorPaths><path><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></path></annotationProcessorPaths></configuration></plugin><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build></project>

image-20251203131238035

image-20251203131259403

image-20251203131720624

<?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"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.5.7</version>
<!--        父工程pom.xml的相对路径-->
<!--        如果无配置且自闭和,代表将会从本地仓库中查找,如果找不到就从中央仓库中查找--><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.itheima</groupId><artifactId>tlias-parent</artifactId><version>1.0-SNAPSHOT</version><packaging>pom</packaging><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><!--        自定义属性--><lombok.version>1.18.42</lombok.version><spring.boot.starter.version>3.5.7</spring.boot.starter.version><aliyun.sdk.version>3.17.4</aliyun.sdk.version><jaxb.api.version>2.3.1</jaxb.api.version><activation.version>1.1.1</activation.version><jaxb.runtime.version>2.3.3</jaxb.runtime.version><jjwt-api.version>0.12.5</jjwt-api.version><jjwt-impl.version>0.12.5</jjwt-impl.version><jjwt-jackson.version>0.12.5</jjwt-jackson.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId><version>${spring.boot.starter.version}</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>${lombok.version}</version><optional>true</optional></dependency></dependencies><!--    统一管理依赖的版本--><dependencyManagement><dependencies><!-- 阿里云OSS的依赖--><dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>${aliyun.sdk.version}</version></dependency><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>${jaxb.api.version}</version></dependency><dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>${activation.version}</version></dependency><!-- no more than 2.3.3--><dependency><groupId>org.glassfish.jaxb</groupId><artifactId>jaxb-runtime</artifactId><version>${jaxb.runtime.version}</version></dependency><!-- JWT令牌的依赖--><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-api</artifactId><version>${jjwt-api.version}</version></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-impl</artifactId><version>${jjwt-impl.version}</version><scope>runtime</scope></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt-jackson</artifactId><version>${jjwt-jackson.version}</version><scope>runtime</scope></dependency></dependencies></dependencyManagement>
</project>

image-20251203133720764

执行生命周期的过程中,比如package会到本地仓库去寻找依赖,所以得先把依赖安装到本地仓库(比如pojo)

image-20251203134027726

聚合

image-20251203140327134

image-20251203140724560

image-20251203140921413

私服

image-20251203141433335

image-20251203141450557

上传与下载

image-20251203142534942

image-20251203142604761

image-20251203142851799

image-20251203153056648

<!-- 1. 私服账号密码(id 与仓库 id 一致,确保认证生效) -->
<servers><!-- 仓库 id 是 maven-public,这里 server id 也必须是 maven-public --><server><id>maven-releases</id><username>admin</username><password>admin</password></server><server><id>maven-snapshots</id><username>admin</username><password>admin</password></server>
</servers><!-- 2. 私服仓库配置(Profile id 与激活的一致) -->
<profiles><profile><id>allow-snapshots</id> <!-- 定义的 Profile id --><activation><activeByDefault>true</activeByDefault> <!-- 默认激活,也可以通过 activeProfiles 激活 --></activation><repositories><repository><id>maven-public</id> <!-- 和 server 的 id 一致,关联账号密码 --><url>http://localhost:8081/repository/maven-public/</url> <!-- 你的私服公共仓库 URL --><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled> <!-- 允许下载快照版本(开发环境用) --></snapshots></repository></repositories><!-- 插件仓库(若私服需要下载 Maven 插件,必须配置,否则插件可能下载失败) --><pluginRepositories><pluginRepository><id>maven-public</id><url>http://localhost:8081/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile>
</profiles><!-- 3. 激活 Profile(id 与上面定义的一致,或删除此节点(因已配置 activeByDefault=true)) -->
<activeProfiles><activeProfile>allow-snapshots</activeProfile> <!-- 与 <profile id="allow-snapshots"> 一致 -->
</activeProfiles><!-- 4. 镜像配置(必须放在 <mirrors> 标签内,优先级:镜像 > 仓库) -->
<mirrors><!-- 私服镜像:所有依赖都走私服(mirrorOf="*" 表示匹配所有仓库) --><mirror><id>maven-public-mirror</id> <!-- 镜像 id 任意,不重复即可 --><mirrorOf>*</mirrorOf> <!-- 匹配所有仓库请求,转发到私服 --><url>http://localhost:8081/repository/maven-public/</url></mirror></mirrors>

总结

image-20251203153603782

image-20251203154530431

http://www.jsqmd.com/news/59800/

相关文章:

  • 实力与口碑兼具:美国移民品牌企业推荐
  • 深聊口碑不错的美国移民企业,看看哪家实力强
  • 第七天敏捷冲刺
  • 北京婚姻律师事务所推荐:聚焦婚姻家事法律服务的专业机构参考
  • PLC编程培训哪家费用优惠?多家机构实力对比
  • vscode正则匹配
  • PLC编程培训机构排名:2025年实力机构推荐
  • await执行顺序和事件循环调度
  • 陈列装置公司哪家有实力?国内优质企业推荐
  • 快闪店设计公司哪家有创意?这些创意机构值得关注
  • 【文章管理系统团队】Alpha阶段Scrum冲刺第7天随笔
  • 做合同管理软件的品牌有哪些?行业热门选择盘点
  • 国产仓储软件(WMS):赋能企业精益化仓储管理新实践
  • 合同管理软件厂商哪家专业?五家实力厂商深度解析
  • 高端陈列道具公司哪家好?行业优质服务商推荐
  • 【文章管理系统团队】Alpha阶段Scrum冲刺第6天随笔
  • 做合同管理软件的公司推荐:行业内值得关注的选择
  • NOIP 2025 游寄 / 反思
  • 2025年最终版:国内空压机品牌推荐TOP10
  • 电力线通信中噪声的建模
  • 【文章管理系统团队】Alpha阶段Scrum冲刺第5天随笔
  • 印美石英砖厂家详细介绍:规模与生产能力揭秘
  • 印美石英砖厂家反馈、合作稳定性与性价比深度剖析
  • GEO优化公司哪家性价比高?2025年精选推荐指南
  • Java语法 | Java概述
  • 【文章管理系统团队】Alpha阶段Scrum冲刺第3天随笔
  • 京东自研电商数据库内核DongSQL简介
  • 2025年尘埃粒子检测仪五大品牌权威评测与推荐,0.1um尘埃粒子计数器/粒子计数器/尘埃粒子检测仪销售厂家哪家靠谱
  • Vi/Vim 高亮Systemverilog语法的设置方式
  • 传统花灯靠谱厂家推荐,太谷县龙腾彩灯厂引领行业之光