我試圖通過命令行下載一些工件與maven。我只知道工件的基本版本,但他們在nexus存儲庫中有單獨的時間戳。Maven依賴項:複製基本版本的工件
例如:
僞影com.mycompany.subject:any-artifact:3.0.0-SNAPSHOT:war:plugins
具有下列座標com.mycompany.subject:any-artifact:3.0.0-20161212.140040-1:war:plugins
在關係存儲庫中。
我要下載的神器是這樣的:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy -Dartifact=com.mycompany.subject:any-artifact:3.0.0-SNAPSHOT:war:plugins -DoutputDirectory=./my-tmp
我的文檔中發現了-Dmdep.useBaseVersion
選項,但這只是節約與基礎版本下載的神器。
編輯:
的問題是,我只知道僞影的基本版本例如3.0.0-SNAPSHOT,當我嘗試從上面的nexus下載它時,它會失敗,因爲nexus中的版本帶有時間戳。
的maven-metadata.xml中:
<metadata>
<groupId>com.mycompany.subject</groupId>
<artifactId>any-artifact</artifactId>
<versioning>
<versions>
<version>3.0.0-SNAPSHOT</version>
</versions>
<lastUpdated>20161214160043</lastUpdated>
</versioning>
</metadata>
錯誤,堆棧跟蹤:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.319 s
[INFO] Finished at: 2016-12-19T15:04:06+01:00
[INFO] Final Memory: 16M/298M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:copy (default-cli) on project standalone-pom: Unable to find artifact. Could not find artifact com.mycompany.subject:any-artifact:3.0.0-SNAPSHOT in <remote-repository-id> (https://<nexus-repo-url>/nexus/repository/<specified-repository>)
[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 ...
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId ...
[ERROR]
[ERROR]
[ERROR] com.mycompany.subject:any-artifact:3.0.0-SNAPSHOT
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] remote-repository-id (https://<nexus-repo-url>/nexus/repository/<specified-repository>),
[ERROR] -> [Help 1]
什麼是目前錯誤?你在尋找什麼結果? – Tunaki
看看我的編輯請。我想使用基本版本下載工件,但版本在存儲庫中有時間戳。 – Oni1
這不應該導致問題。神器經理應該理解'3.0.0-SNAPSHOT'並下載最新的時間戳快照。 Nexus中可能存在配置錯誤。在'http:// yourNexusUrl/com/mycompany/subject/any-artifact'中檢查文件'maven-metadata.xml'。它是什麼樣子的? – Tunaki