Gradle common tasks build file


I tried to create common build file such as "common-web.gradle’ which define some redundant tasks for a web-project (Concat JS, Minify JS, etc). My idea was to include this file in all my web project to avoid copy/past between projects.

My Main problem is to use this file from my build.gradle.

An example is with some task like combineJS task :

task combineJsFiles(type: CombineJsTask) {
source = jsFiles
dest = file("${jsBuildDir}/all.js")

How in my build.gradle, I can define “jsFiles” variable and how I can initialize them in my common-web.gradle to avoid “Could not find property ‘jsSrcDir’ on root project”

Thanks a lot !