Maven:将zip文件上载并下载到nexus存储库
我已经使用pom将一个zip文件上传到本地nexus存储库。它似乎已正确上载。然后,我尝试使用以下工具将其下载到另一个项目中:Maven:将zip文件上载并下载到nexus存储库,maven,nexus,Maven,Nexus,我已经使用pom将一个zip文件上传到本地nexus存储库。它似乎已正确上载。然后,我尝试使用以下工具将其下载到另一个项目中: <project> <modelVersion>4.0.0</modelVersion> <groupId>com.foo</groupId> <artifactId>projectusingofficestuff</artifactId> <version>
<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>
如果我使用以下命令直接搜索存储库:
它找到工件并返回看起来正确的响应。你知道为什么maven构建无法找到它吗?谢谢你的帮助;我似乎有它的工作。我在另一个问题中找到了答案的线索,这是我最初没有看到的 在上传时,程序集文件名(在我的例子中是bin.xml)被附加到工件名。为了获得下载来定位工件,我需要添加
bin
到工件的依赖项块。您是否可以尝试在您的项目目录中执行
mvn org.apache.maven.plugins:maven dependency plugin:3.0.0:unpack
,以防检查旧版本有任何错误,或者您是否将其绑定到错误的阶段。首先,我怀疑该版本是否正确1.0.0-RELEASE
正确。发布版本通常如下所示:1.0.0
。此外,您似乎通过pluginManagement定义了插件版本,因为您似乎使用了非常旧的maven dependency plugin版本。。。
[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)