我正在Java中启动简单的AWS DynamoDB测试。当然有这样的进口
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
因此,为了解决这个问题,我声明我的项目是Maven的性质,并添加了一种在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>
我有一个运行的本地伪影实例,.m2目录设置.xml我看到了端点http://localhost:8081/artifactory/lib-(释放和快照)在不同的条目中。
pom.xml给出错误
Missing artifact software.amazon.awssdk:bom:jar: 2.0.0
当我尝试执行runas -maven安装时,我会看到以下错误。
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]
我知道它试图告诉我一些东西,但我不明白。
.m2下的存储库文件夹,它具有像我期望的软件/amazon/awssdk/bom/2.0.0及其下方的文件夹结构,bom-2.0.0.0.0.jar.jar.lastupped
Java程序尚未启动
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 {
}
它告诉您,不存在 jar
bom-2.0.0.jar for Software.amazon.awssdk。
看文档。
您必须在dependencyManagement
中定义bom
。也请查看此答案
当您定义依赖关系并执行maven命令时,Maven即使无法下载依赖项,也会自动创建文件夹结构。