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

门户网站建设工作室asp网站 换模板

门户网站建设工作室,asp网站 换模板,互联网网站备案流程,移动应用开发代码2019独角兽企业重金招聘Python工程师标准 Maven学习总结(五)——聚合与继承 一、聚合 如果我们想一次构建多个项目模块#xff0c;那我们就需要对多个项目模块进行聚合 1.1、聚合配置代码 1 modules 2 module模块一/module 3 … 2019独角兽企业重金招聘Python工程师标准 Maven学习总结(五)——聚合与继承 一、聚合   如果我们想一次构建多个项目模块那我们就需要对多个项目模块进行聚合 1.1、聚合配置代码 1 modules 2 module模块一/module 3 module模块二/module 4 module模块三/module 5 /modules   例如对项目的Hello、HelloFriend、MakeFriends这三个模块进行聚合 1 modules 2 module../Hello/module 3 module../HelloFriend/module 4 module../MakeFriends/module 5 /modules   其中module的路径为相对路径。 二、继承   继承为了消除重复我们把很多相同的配置提取出来例如grouptIdversion等 2.1、继承配置代码 1 parent 2 groupIdme.gacl.maven/groupId 3 artifactIdParentProject/artifactId 4 version0.0.1-SNAPSHOT/version 5 relativePath../ParentProject/pom.xml/relativePath 6 /parent 2.2、继承代码中定义属性   继承代码过程中可以定义属性例如 1 properties 2 project.build.sourceEncodingUTF-8/project.build.sourceEncoding 3 junit.version4.9/junit.version 4 maven.version0.0.1-SNAPSHOT/maven.version 5 /properties   访问属性的方式为${junit.version}例如 1 dependency 2 groupIdjunit/groupId 3 artifactIdjunit/artifactId 4 version${junit.version}/version 5 scopetest/scope 6 /dependency 2.3、父模块用dependencyManagement进行管理 1 dependencyManagement2 dependencies3 dependency4 groupIdjunit/groupId5 artifactIdjunit/artifactId6 version${junit.version}/version7 scopetest/scope8 /dependency 9 dependency 10 groupIdcn.itcast.maven/groupId 11 artifactIdHelloFriend/artifactId 12 version${maven.version}/version 13 typejar/type 14 scopecompile/scope 15 /dependency 16 /dependencies 17 /dependencyManagement   这样的好处是子模块可以有选择行的继承而不需要全部继承。 三、聚合与继承的关系   聚合主要为了快速构建项目继承主要为了消除重复 四、聚合与继承实战演练   创建四个Maven项目如下图所示       这四个项目放在同一个目录下方便后面进行聚合和继承      Parent项目是其它三个项目的父项目主要是用来配置一些公共的配置其它三个项目再通过继承的方式拥有Parent项目中的配置首先配置Parent项目的pom.xml添加对项目的Hello、HelloFriend、MakeFriends这三个模块进行聚合以及jar包依赖pom.xml的配置信息如下   Parent项目的pom.xml配置 1 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance2 xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd3 modelVersion4.0.0/modelVersion4 5 groupIdme.gacl.maven/groupId6 artifactIdParent/artifactId7 version0.0.1-SNAPSHOT/version8 packagingpom/packaging9 10 nameParent/name 11 urlhttp://maven.apache.org/url 12 13 !-- 对项目的Hello、HelloFriend、MakeFriends这三个模块进行聚合 -- 14 modules 15 module../Hello/module 16 module../HelloFriend/module 17 module../MakeFriends/module 18 /modules 19 20 !-- 定义属性 -- 21 properties 22 project.build.sourceEncodingUTF-8/project.build.sourceEncoding 23 junit.version4.9/junit.version 24 maven.version0.0.1-SNAPSHOT/maven.version 25 /properties 26 27 !-- 用dependencyManagement进行jar包依赖管理 -- 28 dependencyManagement 29 !-- 配置jar包依赖 -- 30 dependencies 31 dependency 32 groupIdjunit/groupId 33 artifactIdjunit/artifactId 34 !-- 访问junit.version属性 -- 35 version${junit.version}/version 36 scopetest/scope 37 /dependency 38 dependency 39 groupIdme.gacl.maven/groupId 40 artifactIdHello/artifactId 41 !-- 访问maven.version属性 -- 42 version${maven.version}/version 43 scopecompile/scope 44 /dependency 45 dependency 46 groupIdme.gacl.maven/groupId 47 artifactIdHelloFriend/artifactId 48 !-- 访问maven.version属性 -- 49 version${maven.version}/version 50 /dependency 51 /dependencies 52 /dependencyManagement 53 /project   在Hello项目的pom.xml中继承Parent项目的pom.xml配置 1 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance 2 xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd3 4 modelVersion4.0.0/modelVersion5 artifactIdHello/artifactId6 7 !-- 继承Parent项目中的pom.xml配置 --8 parent 9 groupIdme.gacl.maven/groupId 10 artifactIdParent/artifactId 11 version0.0.1-SNAPSHOT/version 12 !-- 使用相对路径 -- 13 relativePath../Parent/pom.xml/relativePath 14 /parent 15 16 dependencies 17 dependency 18 groupIdjunit/groupId 19 artifactIdjunit/artifactId 20 /dependency 21 /dependencies 22 /project   在HelloFriend项目的pom.xml中继承Parent项目的pom.xml配置 1 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance2 xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd3 modelVersion4.0.0/modelVersion4 artifactIdHelloFriend/artifactId5 nameHelloFriend/name6 7 !-- 继承Parent项目中的pom.xml配置 --8 parent9 groupIdme.gacl.maven/groupId 10 artifactIdParent/artifactId 11 version0.0.1-SNAPSHOT/version 12 relativePath../Parent/pom.xml/relativePath 13 /parent 14 dependencies 15 dependency 16 !-- Parent项目的pom.xml文件配置中已经指明了要使用的Junit的版本号因此在这里添加junit的依赖时 17 可以不指明version/version和scopetest/scope会直接从Parent项目的pom.xml继承 -- 18 groupIdjunit/groupId 19 artifactIdjunit/artifactId 20 /dependency 21 !-- HelloFriend项目中使用到了Hello项目中的类因此需要添加对Hello.jar的依赖 22 Hello.jar的version和scope也已经在Parent项目的pom.xml文件配置中已经指明了 23 因此这里也可以省略不写了 24 -- 25 dependency 26 groupIdme.gacl.maven/groupId 27 artifactIdHello/artifactId 28 /dependency 29 /dependencies 30 /project   在MakeFriends项目的pom.xml中继承Parent项目的pom.xml配置 1 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance2 xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd3 modelVersion4.0.0/modelVersion4 artifactIdMakeFriends/artifactId5 !-- 继承Parent项目中的pom.xml配置 --6 parent7 groupIdme.gacl.maven/groupId8 artifactIdParent/artifactId9 version0.0.1-SNAPSHOT/version 10 relativePath../Parent/pom.xml/relativePath 11 /parent 12 dependencies 13 dependency 14 !-- Parent项目的pom.xml文件配置中已经指明了要使用的Junit的版本号因此在这里添加junit的依赖时 15 可以不指明version/version和scopetest/scope会直接从Parent项目的pom.xml继承 -- 16 groupIdjunit/groupId 17 artifactIdjunit/artifactId 18 /dependency 19 dependency 20 !-- MakeFriends项目中使用到了HelloFriend项目中的类因此需要添加对HelloFriend.jar的依赖 21 HelloFriend.jar的version和scope也已经在Parent项目的pom.xml文件配置中已经指明了 22 因此这里也可以省略不写了 23 -- 24 groupIdme.gacl.maven/groupId 25 artifactIdHelloFriend/artifactId 26 /dependency 27 /dependencies 28 /project   以上的四个项目的pom.xml经过这样的配置之后就完成了在Parent项目中聚合Hello、HelloFriend、MakeFriends这三个子项目(子模块)而Hello、HelloFriend、MakeFriends这三个子项目(子模块)也继承了Parent项目中的公共配置这样就可以使用Maven一次性构建所有的项目了如下图所示      选中Parent项目的pom.xml文件→【Run As】→【Maven install】这样Maven就会一次性同时构建Parent、Hello、HelloFriend、MakeFriends这四个项目如下图所示    转载于:https://my.oschina.net/zhanghaiyang/blog/597627
http://www.pierceye.com/news/380580/

相关文章:

  • 长沙建网站培训机构织梦网站采集侠怎么做
  • 行政事业单位网站建设动漫设计与制作大学
  • 网站链接推广工具建立网站平台
  • 做网站需要学什么软件做网站智能工具
  • 成品网站代理上海的建设项目招投标在哪个网站
  • 阿里云的网站建设花钱么广州市建设职业培训学校网站
  • 网站建设和前端开发的区别哈尔滨网站制作方案
  • 改进网站的建议网易邮箱网页版
  • 南宁市做网站的公司新浪云能用wordpress
  • 网站建设品牌有哪些重庆seo排名收费
  • 发优惠券网站怎么做大连开发区做网站
  • 烟台免费网站建设宝应网站开发
  • 用网站做淘宝客的人多吗3liang 设计网站 源码
  • 实训小结网站建设国内外最新新闻
  • 最新网站排名优化方法云龙徐州网站开发
  • 扬州做网站多少钱免费拿货的代理商
  • html做校园网站服装设计图片
  • 做三网站推广一般给多少钱
  • 网站关键词的写法牛肉煲的做法
  • 网站权限怎么设置吉林电商网站建设报价
  • wordpress修改站点名wordpress 插件 调用
  • vs2015做的网站广东省白云区属于哪个市
  • 微信群投票网站怎么做佳木斯做网站公司
  • 建设网站用哪个主机好阳西哪里有做网站
  • 沈阳市有做网站的公司中文企业网站html模板
  • 破解织梦做的网站有什么页游传奇平台好
  • 临安网站开发网站建设做什么费用
  • 辽宁建设工程信息网网站python 网站开发
  • 企业网站.net免费做ppt的网站
  • 浦城 做网站wordpress下载页面