Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Error #125

Open
harshanarayana opened this issue Dec 12, 2017 · 3 comments
Open

Import Error #125

harshanarayana opened this issue Dec 12, 2017 · 3 comments

Comments

@harshanarayana
Copy link

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.

buildscript {
    ext {
        awsPluginVersion = "0.30"

        configureRepositories = {
            mavenCentral()
            maven { url 'https://plugins.gradle.org/m2/' }
        }
    }

    repositories(configureRepositories)

    dependencies {
        classpath "jp.classmethod.aws:gradle-aws-plugin:${awsPluginVersion}"
    }
}

apply plugin: 'jp.classmethod.aws'
apply plugin: 'jp.classmethod.aws.s3'

apply from: "gradle-scripts/common.gradle"
apply from: "gradle-scripts/aws-deploy.gradle"

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
@nabedge
Copy link

nabedge commented Nov 20, 2018

me too.

@wreulicke
Copy link

I seems that this issue is gradle-limitation.
I found this.

@nabedge Does you work with for you?

@ussuritiger
Copy link

Has anyone managed to find a solution for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants