打包war时的Grails事件列表

打包war时的Grails事件列表,grails,war,Grails,War,我在寻找打包战争文件时的事件列表。 主要原因是在构建完成时创建一个具有系统构建id的文件 我试着用谷歌搜索它,但没有找到。根据你的评论,听起来你想要一个可以使用的自定义甘特脚本。您可以使用命令创建自己的脚本 假设您使用grails创建脚本MyCustomBuild 下面是一个非常简单的脚本示例: // MyCustomBuild.groovy includeTargets << grailsScript("_GrailsInit") includeTargets << g

我在寻找打包战争文件时的事件列表。 主要原因是在构建完成时创建一个具有系统构建id的文件


我试着用谷歌搜索它,但没有找到。根据你的评论,听起来你想要一个可以使用的自定义甘特脚本。您可以使用命令创建自己的脚本

假设您使用
grails创建脚本MyCustomBuild

下面是一个非常简单的脚本示例:

// MyCustomBuild.groovy
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsWar")

target(main: "Create a WAR and append to text file") {
    // build the WAR file
    war()

    // Append to the file
    // insert your logic here for creating your build number
    def buildNumber = new Date().getTime()
    def file = new File("somefile.txt")
    file.append("Build #: ${buildNumber}\n")
}

setDefaultTarget(main)

通过使用此选项解决:

def webAppDir=“${basedir}”+”/web app/”
def buildNumber=new SimpleDateFormat(“yMMdd.HHmm”).format(new Date())
新文件(webAppDir+“buildNumber.properties”).delete()
def file=新文件(webAppDir+“buildNumber.properties”)

file.append(“app.buildNumber=“+buildNumber)

不清楚您在问什么。您能否重新表述您的问题,并给出示例或解释您正在尝试生产/做什么?在我的项目中,每次完成war创建时,我都会生成一些版本号id,这些id应该保存在一个文件中。这个过程应该在完成创建WAR文件时进行。您将它放在哪个文件中?
grails mycustombuild