0
我已經使用pom將zip文件上傳到本地nexus存儲庫。它似乎已正確上傳。然後我嘗試使用下載它在另一個項目:Maven:上傳和下載zip文件到nexus存儲庫
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>projectusingofficestuff</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependency</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.foo</groupId>
<artifactId>officestuff</artifactId>
<type>zip</type>
<version>1.0.0-RELEASE</version>
<overWrite>true</overWrite>
<outputDirectory>target/unpacked</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
當我嘗試下載,我得到:
[DEBUG] (s) remoteRepos = [ id: nexus
url: http://repository/nexus/repository/maven-public
layout: default
snapshots: [enabled => false, update => daily]
releases: [enabled => true, update => daily]
]
[DEBUG] (f) silent = false
[DEBUG] -- end configuration --
[INFO] Configured Artifact: com.foo:officestuff:1.0.0-RELEASE:zip
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repository/nexus/repository/maven-public as mike
Downloading: http://repository/nexus/repository/maven-public/com/foo/officestuff/1.0.0-RELEASE/officestuff-1.0.0-RELEASE.zip
[DEBUG] Writing resolution tracking file /home/mike/.m2/repository/com/foo/officestuff/1.0.0-RELEASE/officestuff-1.0.0-RELEASE.zip.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.763s
[INFO] Finished at: Wed Jan 04 16:13:20 EST 2017
[INFO] Final Memory: 20M/962M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack (copy-dependency) on project projectusingofficestuff: Unable to find artifact. Could not find artifact com.foo:officestuff:zip:1.0.0-RELEASE in nexus (http://repository/nexus/repository/maven-public)
它發現神器並返回看起來像是正確的迴應。任何想法爲什麼Maven構建不能找到它?
你可以嘗試在你的項目目錄下執行'mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.0:unpack',以防萬一檢查舊版本是否有bug或者是否綁定它可能是一個錯誤的階段。 – nullpointer
首先,我懷疑'1.0.0-RELEASE'版本是否正確。通常發佈版本看起來像這樣:'1.0.0'。此外,你似乎通過pluginManagement定義你的插件版本,因爲你似乎正在使用一個非常老版本的maven-dependency-plugin ... – khmarbaise