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

商务网站规划与建设心得庆阳网站建设

商务网站规划与建设心得,庆阳网站建设,品质好坏质量,百度如何提交网站文章目录 背景一般的实现使用spring-boot-dependencies 更优雅的实现. 背景 有时候构建一个多模块maven项目其中某一个模块是web-service需要使用spring boot,其他模块跟spring boot 完全无关,本文总结一下在这个场景下maven项目最佳构建方式. 一般的实现 网上应该也看到过很… 文章目录 背景一般的实现使用spring-boot-dependencies 更优雅的实现. 背景 有时候构建一个多模块maven项目其中某一个模块是web-service需要使用spring boot,其他模块跟spring boot 完全无关,本文总结一下在这个场景下maven项目最佳构建方式. 一般的实现 网上应该也看到过很多人写的文章,思路非常简单,即是将整个项目作为spring-boot-starter-parent 的子项目. 这样整个项目里面所有模块都可以在dependencies里面添加上有parent内指定版本的spring boot 相关的起步依赖包. 而不需要使用spring的模块可以完全不用管这个parent pom. 比如要构建如下含有三个模块的maven project: module namedescriptioncore存放一些公共的类的模块,可被其他模块使用web-servicespring boot service 对外提供rest apispark-jobspark 项目 project的pom.xml如下: ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.7.18/version/parentgroupIdorg.mytest/groupIdartifactIddemo1/artifactIdversion1.0-SNAPSHOT/versionpackagingpom/packagingmodulesmoduleweb-service/modulemodulespark-job/modulemodulecore/module/modulespropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties/projectcore 模块的pom.xml如下: ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo1/artifactIdversion1.0-SNAPSHOT/version/parentartifactIdcore/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties/projectweb-service的pom如下 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo1/artifactIdversion1.0-SNAPSHOT/version/parentartifactIdweb-service/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build /projectspark-job的pom如下(大致的pom不讨论细节) ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo1/artifactIdversion1.0-SNAPSHOT/version/parentartifactIdspark-job/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties/project这样构建的项目由于使用spring-boot-starter-parent 作为parent pom所以整个项目其实是下图的结构: 这个结构看起来不是那么舒服,比如这里买的spark-job模块,跟spring完全没关, 不应该让spring-boot-started-parent作为其parent.那么有没有什么方法能够不使用spring-boot-starter-parent作为整个项目的parent也能完全解决spring boot依赖的问题呢?答案是有的. 使用spring-boot-dependencies 更优雅的实现. spring 本身提供了这样一个pom 来管理所有依赖: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies 且官方也给了怎么使用这个pom的方法 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-dependencies/artifactIdversion2.7.18/versiontypepom/typescopeimport/scope /dependency有了这个pom引入到项目里面,就可以不用将spring-boot-starter-parent作为整个项目的parent. 改造一下项目的pom project pom.xml 如下 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.mytest/groupIdartifactIddemo2/artifactIdversion${revision}/versionpackagingpom/packagingmodulesmodulecore/modulemoduleweb-service/modulemodulespark-job/module/modulespropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.target!--revision统一版本号--revision1.0/revisionspring.boot.version2.7.18/spring.boot.versionproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/propertiesdependencyManagementdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-dependencies/artifactIdversion${spring.boot.version}/versiontypepom/typescopeimport/scope/dependency!--core模块依赖声明--dependencygroupIdorg.mytest/groupIdartifactIdcore/artifactIdversion${project.version}/version/dependency/dependencies/dependencyManagement/projectcore 模块 pom.xml 如下 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo2/artifactIdversion${revision}/version/parentartifactIdcore/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties/projectweb-service的pom.xml如下: ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo2/artifactIdversion${revision}/version/parentartifactIdweb-service/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/propertiesdependencies!--web-service中引入core模块--dependencygroupIdorg.mytest/groupIdartifactIdcore/artifactIdversion${project.version}/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency/dependencies/projectspark-job的pom.xml(大致的pom不讨论细节)如下 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.mytest/groupIdartifactIddemo2/artifactIdversion${revision}/version/parentartifactIdspark-job/artifactIdpropertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncoding/properties/project改进之后项目就不存在以spring-boot-starter-parent作为整个项目的parent实现spring boot依赖包的管理. 项目结构如下:
http://www.zqtcl.cn/news/848844/

相关文章:

  • 网站建站网站设计网站制作书生
  • 租号网站是怎么做的wordpress 快讯功能
  • 口碑好的盐城网站建设wordpress课堂主题
  • 网站品牌打造wordpress插件有木马
  • 网站开发与软件研发有什么区别查网站域名备案查询系统
  • 硬盘做免费嗳暧视频网站黄冈免费网站推广平台汇总
  • node做网站怎么知道蜘蛛来过怎么学网站设计
  • 青海省建设厅网站公示公告简单建站
  • 手机网站用什么后台wordpress 百度蜘蛛
  • 网站文章伪原创怎么做手机网站 程序
  • 网站建设每月工作多少开发小程序的目的
  • 社区网站建设方案pptwordpress用户名在哪看
  • 浙江企业响应式网站建设公司简介如何写
  • 自己做静态网站的步骤店面设计在线
  • 活动汪活动策划网站wordpress 无法保存
  • 门户网站开发案例兰州需要做网站的公司有哪些
  • 东莞企业网站asp网站怎么安装
  • 个人做公司网站网站备案取消接入
  • 崇信网站建设it外包的收益主要有哪些
  • 安陆做网站多少钱免费网站定制
  • 快递网站模版长春好的做网站公司有哪些
  • 怎么利用公司网站开发客户网站建设重点步骤
  • 网站站内推广用个人电脑做网站的步骤
  • 网站设计主要包含3个方面陕西城乡住房建设部网站
  • 专门做汽车配件的网站东莞招聘网有哪些比较好
  • 网站前台怎么套用织梦后台小网站怎么建设
  • 网站框架代码深圳手机网站设计
  • 更改网站主题九江建网站的公司
  • 如何分析一个网站网站页面建设
  • 做网站好网页制作3个网页的网站图片