首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

在Maven2插件顶用Velocity对配置文件的集中管理

2012-10-26 
在Maven2插件中用Velocity对配置文件的集中管理正如我在“用Velocity进行配置文件信息的集中管理 ”————http

在Maven2插件中用Velocity对配置文件的集中管理

正如我在“用Velocity进行配置文件信息的集中管理 ”————http://danlley.iteye.com/blog/106130 中的许诺,这个专题将专门说说如何在Maven2插件中用Velocity对配置文件的集中管理。有了上个专题的基础,我这里也就化繁就简了。下面这段代码是通过上个专题的例子进行改写、整理、重构以后的代码,核心任务就是处理配置文件。

?

              1. <build>??
              2. ????<plugins>??
              3. ????????<plugin>??
              4. ????????????<groupId>org.danlleygroupId>??
              5. ????????????<artifactId>maven-velocity-pluginartifactId>??
              6. ????????????<version>1.0version>??
              7. ????????????<configuration>??
              8. ????????????????<template>sample_data.propertiestemplate>??
              9. ????????????configuration>??
              10. ????????????<executions>??
              11. ????????????????<execution>??
              12. ????????????????????<phase>compilephase>??
              13. ????????????????????<goals>??
              14. ????????????????????????<goal>replacegoal>??
              15. ????????????????????goals>??
              16. ????????????????execution>??
              17. ????????????executions>??
              18. ????????plugin>??
              19. ????plugins>??
              20. build>??

              ?

              ?

              加入工程以后我的测试执行结果如下:

              F:\workspaces\maven-velocity-lab>mvn compile
              [INFO] Scanning for projects...
              [INFO] -------------------------------------
              ---
              [INFO] Building maven-velocity-lab
              [INFO]??? task-segment: [compile]
              [INFO] -------------------------------------
              ---
              [INFO] [resources:resources]
              [INFO] Using default encoding to copy filtered resources.
              [INFO] [compiler:compile]
              [INFO] Nothing to compile - all classes are up to date
              [INFO] [velocity:replace {execution: default}]
              [INFO] +-----------------------------------------+
              [INFO] |???????????? Velocity Files:???????????? |
              [INFO] +-----------------------------------------+
              [INFO] dlmchibernate.cfg.xml.danlley
              [INFO] log4j.xml.danlley
              [INFO] dlhibernate.cfg.xml.danlley
              [INFO] download_config.xml.danlley
              [INFO] 生成文件已经被放置在路径:F:\workspaces\maven-velocity-lab\target\classes
              ?请核对!
              [INFO] ------------------------------------
              [INFO] BUILD SUCCESSFUL
              [INFO] ------------------------------------
              [INFO] Total time: 1 second
              [INFO] Finished at: Mon Aug 06 16:38:58 CST 2007
              [INFO] Final Memory: 5M/9M
              [INFO] ------------------------------------

              ?

              参考资料:http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

热点排行