技术中心

这里象征着我们的态度和能力

Maven Web项目部署到Tomcat
作者:中国IT实验室    来源:中国IT实验室    发布时间:2012-03-12      浏览次数:9205
分享到:
欢迎进入Java社区论坛,与200万技术人员互动交流 >>进入
			
  1. <repositories> 
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  (not actually available in the main POM, but used behind the scenes)  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. a subset of the  element, which consists of:  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  

2、激活Profiles

激活profiles有下列几种方式:

Explicitly

Through Maven settings

Based on environment variables

OS settings

Present or missing files

1)通过mvn命令的-P参数来显示激活profiles,该参数值是profile id list(之间用逗号连接)。如:

			
  1. mvn groupId:artifactId:goal -P profileId-1,profileId-2 

2) 通过在settings.xml里设置 element来激活(当然也必须在settings.xml里定义)

			
  1. <settings> 
  2. ...  
  3. <profiles> 
  4. <profile> 
  5. <id>profile1id> 
  6. ...  
  7. profile> 
  8. profiles> 
  9. <activeProfiles> 
  10. <activeProfile>profile-1activeProfile> 
  11. activeProfiles> 
  12. ...  
  13. settings> 

列在里的profiles list会在每一个project执行时被激活

3)Profiles还可以基于detect到的build environment 的state来自动激活,而不需要象上面2种方式显式激活。这只需要在profile定义时使用 element。如:

			
  1. <profiles> 
  2. <profile> 
  3. <activation> 
  4. <jdk>1.4jdk> 
  5. activation> 
  6. ...  
  7. profile> 
  8. profiles> 

上面的代码表示:如果JDK version start with 1.4 (eg. "1.4.0_08", "1.4.2_07", "1.4"),该profile会被激活

			
  1. <profiles> 
  2. <profile> 
  3. <activation> 
  4. <property> 
  5. <name>debugname> 
  6. property> 
  7. activation> 
  8. ...  
  9. profile> 
  10. profiles> 

上面的代码表示:如果存在system propertie “debug”,该profile会被激活。为了激活它,输入的命令类似于:

			
  1. mvn groupId:artifactId:goal ?Ddebug 
			
  1. <profiles> 
  2. <profile> 
  3. <activation> 
  4. <property> 
  5. <name>environmentname> 
  6. <value>testvalue> 
  7. property> 
  8. activation> 
  9. ...  
  10. profile> 
  11. profiles> 

上面的代码表示:如果存在system propertie “environment”的值为test,该profile会被激活。为了激活它,输入的命令类似于:

			
  1. mvn groupId:artifactId:goal -Denvironment=test 

4)Profiles还可以基于OS setting来自动激活

			
  1. <profiles> 
  2. <profile> 
  3. <activation> 
  4. <os> 
  5. <name>Windows XPname> 
  6. <family>Windowsfamily> 
  7. <arch>x86arch> 
  8. <version>5.1.2600version> 
  9. os> 
  10. activation> 
  11. ...  
  12. profile> 
  13. profiles> 

[1] [2] 下一页

4000-880-989
(24小时热线)
联系客服
微信公众号

官方公众号

小程序

©2008-2022 CORPORATION ALL Rights Reserved. 昆明奥远科技有限公司版权所有 滇ICP备09003328号-1 滇公网安备 53011102000818号 增值电信业务经营许可证号:滇B2-20110045
昆明那家网络公司好,新媒体运营,网站优化,网络推广,网站建设,网页设计,网站设计,网站推广,云南网站公司,昆明新媒体公司,云南网红主播,昆明SEO公司,昆明网站建设,昆明网络推广,昆明网站优化,昆明网站推广,红河网站建设,大理网络公司,曲靖网络公司,丽江网站设计,昭通网络公司,保山大数据服务,智慧高速建设,智慧校园服务,云南IDC服务商,网络安全测评,等保测评,网站关键词排名优化服务,服务客户尽超2000余家,一切尽在奥远科技,服务电话:13888956730