【问题标题】:How do I solve the Missing Artifact problem in pom.xml如何解决 pom.xml 中缺少工件的问题
【发布时间】:2019-07-12 08:11:55
【问题描述】:

我正在 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>

我有一个正在运行的本地 Artifactory 实例和 .m2 目录 settings.xml 我在不同的条目中看到端点 http://localhost:8081/artifactory/lib-(release 和快照。

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 下有存储库文件夹,其文件夹结构类似于我期望的 software/amazon/awssdk/bom/2.0.0 和 bom-2.0.0.jar.lastupdated 下的文件夹结构

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 {


}

【问题讨论】:

    标签: eclipse maven


    【解决方案1】:

    它告诉你,software.amazon.awssdk 不存在jar bom-2.0.0.jar。

    看看documentation

    您必须在dependencyManagement 中定义一个bom。也可以看看this answer

    当你定义一个依赖并执行一个maven命令时,maven会自动创建文件夹结构,即使它无法下载依赖。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-20
      • 1970-01-01
      • 2010-10-29
      • 2011-10-01
      • 1970-01-01
      • 2018-08-19
      相关资源
      最近更新 更多