【发布时间】:2018-09-22 19:48:39
【问题描述】:
有时我们可能希望将特定的 Maven 工件从存储库下载到本地驱动器。 就我而言,我想在特定 IDE 中使用在 Maven 存储库中发布的第三方库。但是,我使用的 IDE 还没有对 maven 存储库的集成支持,因此使用这个库的唯一方法是将工件下载到我的本地驱动器。 我是 Maven 的新手,任何建议将不胜感激。谢谢。
--更新------
我从其他线程中学习并意识到我应该使用 maven 依赖插件将工件下载到本地文件夹。就我而言,我需要从 maven 存储库下载 google ARCore。我在 maven 存储库中搜索了 ARCore,并且知道:
类别:com.google.ar,组:core,版本:1.1.0
所以我用下面的命令行来下载它:
mvn dependency:get -Dartifact=com.google.ar:core:1.1.0
但是,下载神器失败,错误信息是这样的:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Missing:
[ERROR] ----------
[ERROR] 1) com.google.ar:core:jar:1.1.0
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.google.ar -DartifactId=core -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.google.ar -DartifactId=core -Dversion=1.1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR] 2) com.google.ar:core:jar:1.1.0
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
有人可以帮忙吗?谢谢。
【问题讨论】:
-
我也有同样的问题,令人困惑:如何下载以及在哪里复制 android studio!。我想要dl.google.com/dl/android/maven2/androidx/core/core/1.1.0/…。这不仅是手动下载的原因。有时存储库站点无法正常工作,您无法构建您的项目。