Following is the Custom Gralde file that contains the Task
import com.amazonaws.services.s3.model.ObjectMetadata
import jp.classmethod.aws.gradle.s3.AmazonS3FileUploadTask
apply plugin: 'jp.classmethod.aws'
apply plugin: 'jp.classmethod.aws.s3'
task zipProject(type: Zip) {
from file('./')
include '*'
include '*/*'
exclude '*.zip'
archiveName 'project-backend.zip'
destinationDir(file("./"))
}
task deployArtifact(type: AmazonS3FileUploadTask, dependsOn: zipProject) {
description "Upload Backend Service As an S3 Artifact for Code Pipeline Based Deploymenet"
file file("./project-backend.zip")
bucketName findProperty("s3BucketName")
key "project-backend.zip"
overwrite true
def m = new ObjectMetadata()
m.setCacheControl("no-cache, no-store")
m.setSSEAlgorithm("AES256")
objectMetadata = m
}
However, when I am running the task for S3 Upload, I get the following Error.
~/I/project-backend 🖖 ❯❯❯ gradle deployArtifact ✘ 1 feature/some_fancy_feature_name✭ ✚ ✱
Parallel execution with configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/path/somepath/project-backend/gradle-scripts/aws-deploy.gradle' line: 11
* What went wrong:
Could not compile script '/Users/path/somepath/project-backend/gradle-scripts/aws-deploy.gradle'.
> startup failed:
script '/Users/path/somepath/project-backend/gradle-scripts/aws-deploy.gradle': 11: unable to resolve class jp.classmethod.aws.gradle.s3.AmazonS3FileUploadTask
@ line 11, column 1.
import jp.classmethod.aws.gradle.s3.AmazonS3FileUploadTask
^
script '/Users/path/somepath/project-backend/gradle-scripts/aws-deploy.gradle': 10: unable to resolve class com.amazonaws.services.s3.model.ObjectMetadata
@ line 10, column 1.
import com.amazonaws.services.s3.model.ObjectMetadata
^
2 errors
I am trying to create a custom task that zips the entire project Dir and uploads it to S3 for Code Pipeline based Deployment.
My Parent
build.gradle
has the following.Following is the Custom Gralde file that contains the Task
However, when I am running the task for S3 Upload, I get the following Error.