aws / aws-database-encryption-sdk-dynamodb

AWS Database Encryption SDK for DynamoDB in Java
Apache License 2.0
20 stars 11 forks source link

Errors while compiling the Java examples of the latest version of the libraray #1475

Open franckouam opened 3 days ago

franckouam commented 3 days ago

Issue: Running Basic Example (BasicPutGetExample) in AWS Database Encryption SDK for DynamoDB

Description

I am trying to run the Java basic example BasicPutGetExample in the AWS Database Encryption SDK for DynamoDB to understand its initial functionality. My goal is to run the main without modifying or adding any existing operations.

Environment

Steps Followed

  1. Configured the project as indicated in this README

  2. Added the recommended dependencies. After that, the dependencies section in the file build.gradle.kts looks like this:

    dependencies {
        implementation("software.amazon.cryptography:aws-database-encryption-sdk-dynamodb:i${ddbecVersion}")
        implementation("software.amazon.cryptography:aws-cryptographic-material-providers:${mplVersion}")

        implementation(platform("software.amazon.awssdk:bom:2.19.1"))
        implementation("software.amazon.awssdk:arns")
        implementation("software.amazon.awssdk:auth")
        implementation("software.amazon.awssdk:dynamodb")
        implementation("software.amazon.awssdk:dynamodb-enhanced")
        implementation("software.amazon.awssdk:kms")
        implementation("software.amazon.awssdk:sts")

        implementation("org.bouncycastle:bcprov-jdk18on:1.72")

        // https://mvnrepository.com/artifact/org.testng/testng
        testImplementation("org.testng:testng:7.5")

        implementation("software.amazon.cryptography:aws-database-encryption-sdk-dynamodb:3.1.2")
        implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.0")
        implementation(platform("software.amazon.awssdk:bom:2.19.1"))
        implementation("software.amazon.awssdk:dynamodb")
        // The following are optional:
        implementation("software.amazon.awssdk:dynamodb-enhanced")
        implementation("software.amazon.awssdk:kms")
    }
  1. Installed the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
  2. Compiled using ./gradlew build.

Problem Encountered

After compilation, I have the errors below:

    > Task :compileJava FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':compileJava'.
    > Could not resolve all files for configuration ':compileClasspath'.
    > Could not find software.amazon.cryptography:aws-cryptographic-material-providers:1.7.2-SNAPSHOT.
        Searched in the following locations:
        - file:/home/ubuntu/.m2/repository/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - file:/home/ubuntu/.m2/repository/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        - https://s3-us-west-2.amazonaws.com/dynamodb-local/release/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - https://s3-us-west-2.amazonaws.com/dynamodb-local/release/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        - https://repo.maven.apache.org/maven2/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - https://repo.maven.apache.org/maven2/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        Required by:
            project :
    > Could not find software.amazon.cryptography:aws-cryptographic-material-providers:1.7.2-SNAPSHOT.
        Searched in the following locations:
        - file:/home/ubuntu/.m2/repository/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - file:/home/ubuntu/.m2/repository/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        - https://s3-us-west-2.amazonaws.com/dynamodb-local/release/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - https://s3-us-west-2.amazonaws.com/dynamodb-local/release/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        - https://repo.maven.apache.org/maven2/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/maven-metadata.xml
        - https://repo.maven.apache.org/maven2/software/amazon/cryptography/aws-cryptographic-material-providers/1.7.2-SNAPSHOT/aws-cryptographic-material-providers-1.7.2-SNAPSHOT.pom
        Required by:
            project :

    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s
    2 actionable tasks: 1 executed, 1 up-to-date

Question

Do you have any suggestions or specific steps to resolve this issue and successfully run the example? Any assistance or guidance on the required configurations would be greatly appreciated.

josecorella commented 3 days ago

Hey @franckouam!

The build.gradle.kts is defined to work with our development cycle to ensure our examples remain up to date.

Are you trying to build the examples from source? Or are you trying to replicate an example in a sample project? From your build.gradle.kts you have both

implementation("software.amazon.cryptography:aws-database-encryption-sdk-dynamodb:${ddbecVersion}")
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:${mplVersion}")

and

implementation("software.amazon.cryptography:aws-database-encryption-sdk-dynamodb:3.1.2")
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.0")

You should consolidate these duplicates to one. Ideally, you would depend on the latest publish versions.

For the AWS Database Encryption SDK for DynamoDB that is 3.7.0 and for the AWS Material Providers Library that is 1.7.0

franckouam commented 17 hours ago

Hey @josecorella!

Thanks for your answer. For the context i'm trying to build the examples from source. I updated the build.gradle.kts as you suggested. I still have errors while running ./gradlew build. It might be a problem with the execution of the test cases. I put the logs of the compilation down below.

Thanks again build_log.txt