Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks
如果在maven的pom.xml文件中,想像ant那样引用外部的properties配置文件,可以通过两种方式解决:
1.如果需要引用外部propertiest文件中的属性值,需要在pom.xml中添加对外部文件的引用。例如,创建一个外部资源文件pom.properties:
# filter.properties
my.filter.value=hello!

将对它的引用添加到pom.xml中:

<build>
<filters>
<filter>${baseDir}/pom.properties</filter>
</filters>
</build>
不过这种方式要启动资源过滤,并设置好对应的文件夹才行,相对较麻烦。 2.使用插件:
maven-properties-plugin  使用方法可以看插件的官方地址:http://haroon.sis.utoronto.ca/zarar/properties-maven-plugin/index.html

properties-maven-plugin  使用方法可以看插件的官方地址:http://mojo.codehaus.org/properties-maven-plugin/
posted on 2010-02-08 10:42 seal 阅读(6916) 评论(0)  编辑  收藏 所属分类: Maven

只有注册用户登录后才能发表评论。


网站导航: