import com.amazonaws.services.dynamodbv2.document.DynamoDB; the document part of the import cannot be resolved

Question:

I tried to update my dynamodb using aws but I am not able to create a dynamodb object or a table object as the import com.amazonaws.services.dynamodbv2.**document**.* does not register document but it reads all the other imports:

Below is the full class I am using:

Answer:

I had a similar problem and what I’ve learned is that the availability of, and/or source repositories for, packages can change over time.Therefore, if an import cannot be resolved, the following procedure may help.

  1. Identify the package that supplies the dependency.
  2. Locate a source for the package.
  3. Configure the source with Gradle or Maven.

For my answer, I verified your desired imports against com.amazonaws:DynamoDBLocal:1.11.477 under Kotlin.

From the artifact page at MVNRepository, I selected View All.

This led me to a repository source with the following URL:

https://repository.mulesoft.org/nexus/content/repositories/public/com/amazonaws/DynamoDBLocal/1.11.477/

Since I was using Kotlin, I added the corresponding repository data to repositories in my build.gradle.kts for Gradle.

These imports, for the non-local case, can also be satisfied from the package at:

http://central.maven.org/maven2/com/amazonaws/aws-java-sdk-dynamodb/1.11.564/

Therefore, the following entries also work:

After configuring my project for either the local or remote versions, I was able to verify that all of your imports that include “document” were available.

Leave a Reply