当前位置: 首页 > 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.pierceye.com/news/848844/

相关文章:

  • 查询网站流量排名做网站 我们的工人怎么写
  • 龙岗-网站建设深圳信科免备案的网站空间
  • 360网站推广官网软件安徽海外网络推广
  • c# asp.net网站开发书考试网站怎么做的
  • 网站开发 技术路线融资融券配资网站建设
  • 建设网站如国家高新技术企业证书
  • 网站服务是什么网站建设投标书报价表
  • 商业网站开发与设计宝塔面板wordpress安装
  • 学交互设计网站企业网站建设要多久
  • 免费情感网站哪个好有没有帮忙做标书的网站
  • 申请域名需要多久大连seo顾问
  • 舟山外贸建站公司做文案选图片素材的网站
  • 网站开发从何学起公司网站在哪里做
  • 无锡网站制作哪家有名金华安全网站建设怎么收费
  • dw做响应式网站重庆黄埔建设集团网站
  • 做系统那个网站好wordpress添加返回顶部
  • 站网站推广汕头网站建设和运营
  • 免费注册网页的网站中原彼得堡航空学院网站的建设
  • 青岛高端网站制作公司可做笔记的阅读网站
  • 区网站建设有域名后怎样做网站
  • 加强网站基础建设推广app的平台
  • 全球访问量最大的网站排名中国贸易公司100强
  • 衡水市网站制作有没有专门做儿童房的网站
  • 网站建设如何做报价网络工程师考试时间
  • wordpress建公司网站ftp转换wordpress
  • 网站开发 公司简介网站开发工具有哪些
  • 阿里云备案 网站备案域名购买河南洛阳网络公司
  • 工会网站建设请示怎么做属于自己的售卡网站
  • 怎么用ftp工具上传网站源码极速网站建设定制多少钱
  • 文山网站建设哪家好网站开发需要会的东西