有时我们可能希望将特定的 Maven 工件从存储库下载到本地驱动器。就我而言,我想使用在特定 IDE 中的 Maven 存储库中发布的第三方库。但是,我使用的 IDE 还没有对 maven 存储库的集成支持,因此使用这个库的唯一方法是将工件下载到我的本地驱动器。我是 maven 的新手,任何建议将不胜感激。谢谢。
- - -更新 - - -
我从其他线程中学习并意识到我应该使用 maven 依赖插件将工件下载到本地文件夹。就我而言,我需要从 maven 存储库下载 google ARCore。我在 Maven 存储库中搜索 ARCore,并知道:
类别:com.google.ar,组:核心,版本: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.
任何人都可以提供帮助吗?谢谢。
如果您查看工件选项的文档:groupId:artifactId:version[:packaging][:classifier]形式的字符串。查看它的最后一个(可选)标记,[:classifier]。我认为这就是你所缺少的。试试这个, mvn dependency:get -Dartifact=com.google.ar:core:1.1.0:jar:jar-with-dependencies
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句