Gradle 排除使用fmpp处理文件夹(但复制它)

Gradle 排除使用fmpp处理文件夹(但复制它),gradle,ant,fmpp,Gradle,Ant,Fmpp,我正在使用FMPP建立我的网站,最近遇到了一个问题。当尝试构建我的项目(使用gradle)时,它会在phpMail中读取文件。有没有办法忽略使用FMPP处理该文件夹,但仍将其复制到我的生成目录?我知道我可以将ignoredir.fmpp文件添加到该文件夹中,但它会完全忽略它,无法复制。下面是我的代码片段 task build_website { group 'csWebsite' description 'Task for compiling the website implem

我正在使用FMPP建立我的网站,最近遇到了一个问题。当尝试构建我的项目(使用gradle)时,它会在phpMail中读取文件。有没有办法忽略使用FMPP处理该文件夹,但仍将其复制到我的生成目录?我知道我可以将ignoredir.fmpp文件添加到该文件夹中,但它会完全忽略它,无法复制。下面是我的代码片段

task build_website {
    group 'csWebsite'
    description 'Task for compiling the website implementing the fmpp templates'
    dependsOn gzipCss
    finalizedBy minifyJs
    ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
        classpath {
            fileset(dir: 'lib', includes: '*.jar')
        }
    }
    doLast {
        ant.fmpp(sourceRoot: "src", outputRoot :"build") {
            data(expandProperties: 'yes',
            """
            base_url: $project.base_url
            google_analytics_number : $project.google_analytics_number
            mail_user : $project.mail_user
            mail_password : $project.mail_password
            mail_recipient : $project.mail_recipient
            upload_folder : $project.upload_folder
            host : $project.host
            port : $project.port
            """
            )
        }        
    }
}

事实上,我真的仔细考虑了这个问题,在后退一步后找到了一个简单的解决方案。我下面更新的代码运行良好

task build_website {
    group 'csWebsite'
    description 'Task for compiling the website implementing the fmpp templates'
    dependsOn gzipCss
    finalizedBy minifyJs
    ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
        classpath {
            fileset(dir: 'lib', includes: '*.jar')
        }
    }
    doLast {
        ant.fmpp(sourceRoot: "src", outputRoot :"build", excludes: "**/vendor/**") {
            data(expandProperties: 'yes',
            """
            base_url: $project.base_url
            google_analytics_number : $project.google_analytics_number
            mail_user : $project.mail_user
            mail_password : $project.mail_password
            mail_recipient : $project.mail_recipient
            upload_folder : $project.upload_folder
            host : $project.host
            port : $project.port
            """
            )
        }  
        copy{
            from "${projectDir}/src/scripts/vendor"
            into "${buildDir}/scripts/vendor"
        }
    }
}

只需忽略FMPP正在处理的文件夹,然后在FMPP完成后发布渐变副本就足够简单了

您可以为该目录中的所有文件设置
copy
处理模式,并将其他文件保留在默认处理模式下,如下所示:
模式:[copy(/scripts/vendor/)]
。注意路径末尾的
/
;这很重要。另请参见文档中的: