Based on this script, here is a simple one which upload a directory structure. I tested it with my Artifactory OSS and it's working.
#!/bin/bash
# Recursively deploys folder content. Attempt checksum deploy first to optimize upload time.
repo_url="http://ip:port/artifactory"
tgt_repo="simple/myrepo"
user=myuser
pass=mypass
dir="$1"
if [ -z "$dir" ]; then echo "Please specify a directory to recursively upload from!"; exit 1; fi
root=${dir#$(dirname "$dir")/}
find "$dir" -type f | sort | while read f; do
rel="$(echo "$f" | sed -e "s#$dir##" -e "s# /#/#")";
echo "Uploading $f"
curl -k -u $user:$pass -T "$f" "${repo_url}/${tgt_repo}/${root}${rel}"
done
Now, you can turn this into Groovy code with a curl command.
Off course it's not as automatic as a simple Gradle task to execute but the job will be done.