在本站的《构建基于Jenkins+Git+Grails持续集成环境》一文中,介绍了在Jenkins上构建Grails持续集成环境。本文将补充如何将Grails插件工程打包发布到artifactory中去。
使用Grails的maven Publisher插件,可以实现对Grails插件工程的打包发布。详细使用方法请看本站《使用Artifactory管理Grails1.3的插件》。
//windows grails maven-deploy "--repository=pluginSnapshots" //linux grails maven-deploy --repository=pluginSnapshots
请仔细看一下windows下的命令,"--repository=pluginSnapshots"必须使用双引号引起来,否则脚本中argsMap.repository取不到值。
你也许还记得Jenkins的Grails插件配置Target的时候,如果命令带有参数,需要用双引号引起来。你应该已经意识到问题了!
我的做法是向Grails插件工程中添加一个脚本,命令如:grails create-script maven-deploy-win。
脚本代码如下:
includeTargets << new File("${mavenPublisherPluginDir}/scripts/_GrailsMaven.groovy")
target(main:"Installs a Grails plugin as a Maven artefact") {
depends(parseArguments)
argsMap.repository=repository
mavenDeploy()
println "Maven deploy complete."
}
setDefaultTarget(main)
脚本调用:"grails maven-deploy-win -Drepository=pluginSnapshots"。可以看出这里实际是将repository参数以变量的方式传入,然后赋给argsMap.repository。这个脚本在linux环境下同样适用。
现在Target可以这样写了:clean test-app "maven-deploy-win -Drepository=pluginSnapshots"。问题解决了!!
如果你还有更好的方法,请联系我们。

最新评论
9 周 6 小时之前
9 周 1 天之前
11 周 5 天之前
11 周 5 天之前
17 周 2 天之前
17 周 4 天之前
19 周 3 天之前
20 周 1 天之前
20 周 2 天之前
20 周 5 天之前