eclipseamazon-web-servicesamazon-sns

The type software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder cannot be resolved


I am following the example code for publishing a topic to SNS, as seen below:

package aws.sns;

import software.amazon.awssdk.services.sns.SnsClient;
import software.amazon.awssdk.services.sns.SnsClientBuilder;
import software.amazon.awssdk.services.sns.model.PublishRequest;

public class AWSNSPublisher
{
    SnsClient client;
    
    public AWSNSPublisher()
    {
        SnsClient sns = SnsClient.builder().region("region").build();
    }
}

However, Eclipse is giving me this error:

The type software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder cannot be resolved. It is indirectly referenced from required .class files

I have the following JARs on my buildpath (I do not have the ability to use maven):

  1. aws-sdk-java-2.17.29
  2. sdk-core-2.17.29
  3. sns-2.17.29

It's exhibiting some other weirdness, which I'm chalking up to the above error: The code completion suggests no other methods for SnsClient.builder(). other than those inherited from Object:

enter image description here

I've also tried cleaning and rebuilding the project to no avail.

I cannot for the life of me figure out what I need to do to make this happy. Any help would be much appreciated.


Solution

  • I just executed this example code -- as shown here:

    enter image description here

    As you can see, I set a break point and walked through the code which was successful. I use IntelliJ. However, for your issue in Eclipse; did you setup your environment and use the POM that is part of this Git repo here:

    https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/example_code/sns

    It looks like your environment did not pull in all of the dependencies.