[英]Maven Dependency Plugin Copy Artifact from Remote Repository
I currently have an archiva remote repository setup on a server that I deploy my war files to. 我目前在将war文件部署到的服务器上具有archiva远程存储库设置。 I have a need to copy the war file from the remote repository into a directory on a server.
我需要将war文件从远程存储库复制到服务器上的目录中。 So I used the maven-dependency-plugin like so
所以我像这样使用了maven-dependency-plugin
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy \
-Dartifact=<groupId>:<artifactId>:<version>:war \
-DoutputDirectory=/home/me/some/directory
Looking at the maven documentation, this command will resolve the dependency then copy it to the directory. 查看maven文档,此命令将解决依赖关系,然后将其复制到目录中。 It downloads the dependency into this structure.
它将依赖项下载到此结构中。
Directory struture
~/.m2/repository/<groupId>/<artifactId>/<version>/<artifactId>-<version>.war
After the artifact is in the local repository the copy command fails and says it can't find the artifact. 工件在本地存储库中之后,复制命令失败,并说找不到该工件。
Unable to find artifact.
Could not find artifact <groupId>:<artifactId>:war:<version>
Does this structure look correct? 这个结构看起来正确吗? The weird thing is the directory structure for junit is the same and when I run
奇怪的是junit的目录结构与我运行时相同
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy \
-Dartifact=junt:junit:4.11:jar \
-DoutputDirectory=/home/me/some/directory
everything works. 一切正常。
I just hit a similar problem, but from Eclipse. 我只是遇到了类似的问题,但来自Eclipse。 Maybe this will help you.
也许这会对您有所帮助。
I am using the copy-dependencies
goal. 我正在使用
copy-dependencies
目标。
In my pom I had to define the remote repo as: 在pom中,我必须将远程仓库定义为:
<repository>
<id>http://maven.xwiki.org</id>
<url>http://maven.xwiki.org/externals</url>
</repository>
Maven from CLI warns about the "://" characters in the above id
, but if I remove them Maven from Eclipse fails to find the dependencies in the remote repo. 来自CLI的Maven警告上述
id
的“://”字符,但是如果我删除它们,则从Eclipse的Maven无法在远程仓库中找到依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.