0

我是Maven的新手。我正在尝试在我的 java/maven2 pom.xml 文件中添加对 org.mapdb 的引用,但 maven 似乎无法从远程存储库下载 mapdb 工件。

我所做的:第一件事:在 settings.xml 中配置远程 maven 存储库

二:为maven配置代理设置

第三:将以下行添加到我的 POM 文件中

<dependency>
    <groupId>org.mapdb</groupId>
    <artifactId>mapdb</artifactId>
    <version>3.0.4</version>
    <type>bundle</type>
</dependency>

我很确定代理和存储库相关的数据没问题:我可以在我的项目中下载任何其他依赖项,例如 org.osgi.core 或 junit。

构建失败并显示以下消息:

Downloading: http://repo1.maven.org/maven2/org/mapdb/mapdb/3.0.4/mapdb-3.0.4.bundle
[INFO] Unable to find resource 'org.mapdb:mapdb:bundle:3.0.4' in repository central (http://repo1.maven.org/maven2)
[INFO]     ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]     ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.mapdb:mapdb:bundle:3.0.4

  Try downloading the file manually from the project website.

  Then, install it using the command: 
  mvn install:install-file -DgroupId=org.mapdb -DartifactId=mapdb -Dversion=3.0.4 -Dpackaging=bundle -Dfile=/path/to/file

   Alternatively, if you host your own repository you can deploy the file there: 
  mvn deploy:deploy-file -DgroupId=org.mapdb -DartifactId=mapdb -Dversion=3.0.4 -Dpackaging=bundle -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
1) com.sirti.NOC.acc_gw:DB_writer:jar:0.0
2) org.mapdb:mapdb:bundle:3.0.4

 ----------
1 required artifact is missing.

for artifact: 
  com.sirti.NOC.acc_gw:DB_writer:jar:0.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

我已经尝试过手动浏览存储库,并且在http://repo1.maven.org/maven2/org/mapdb/mapdb/3.0.4/中看到了 mapdb jar

当然,我可以手动下载并安装 jar,但是如果必须这样做,使用 maven 有什么意义呢?

4

1 回答 1

0

最后,我已经能够下载 mapdb 包了。

只需要删除

<type>bundle</type>

来自依赖声明的标签。

于 2017-06-13T09:58:57.820 回答