Tauqir Chaudhry
Tauqir Chaudhry

Reputation: 121

How do I solve the Missing Artifact problem in pom.xml

I am starting a simple aws dynamoDB test in java. of course there are imports like this

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;

So to resolve this, I declare my project to be Maven nature and add a dependency which looks like this in pom.xml

`<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DynamoDBOperations</groupId>
<artifactId>DynamoDBOperations</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
</plugins>
</build>
<dependencies>
<dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>bom</artifactId>
    <version>2.0.0</version>
</dependency>
</dependencies>
</project>

I have a local Artifactory instance running and .m2 directory settings.xml I see the endpoint http://localhost:8081/artifactory/lib-(release and snapshot) in different entries.

The pom.xml gives error

Missing artifact software.amazon.awssdk:bom:jar: 2.0.0

When I try to do RunAs - Maven Install I see the following error.

Failed to execute goal on project DynamoDBOperations: Could not resolve 
dependencies for project DynamoDBOperations:DynamoDBOperations:jar:0.0.1- 
SNAPSHOT: Failure to find software.amazon.awssdk:bom:jar:2.0.0 in 
http://localhost:8081/artifactory/libs-release was cached in the local 
repository, resolution will not be reattempted until the update interval of 
central has elapsed or updates are forced -> [Help 1] 

I know it is trying to tell me something but I dont get it.

There is repository folder under .m2 which has a folder structure like I would expect software/amazon/awssdk/bom/2.0.0 and under it bom-2.0.0.jar.lastupdated

The java program has not even started yet

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.amazonaws.services.dynamodbv2.model.AttributeDefinition;
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
import com.amazonaws.services.dynamodbv2.model.CreateTableResult;
import com.amazonaws.services.dynamodbv2.model.KeySchemaElement;
import com.amazonaws.services.dynamodbv2.model.KeyType;
import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput;
import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType;
public class DynamoDBOperations {


}

Upvotes: 0

Views: 3112

Answers (1)

wirnse
wirnse

Reputation: 1136

It is telling you, that there does not exist a jar bom-2.0.0.jar for software.amazon.awssdk.

Have a look at the documentation.

You have to define a bom in dependencyManagement. Also have a look at this answer

When you define a dependency and execute a maven command, maven automatically creates the folder structure, even if it cannot download the dependency.

Upvotes: 1

Related Questions