【问题标题】:Upload third party packages to my own maven repository server using maven使用 maven 将第三方包上传到我自己的 maven 存储库服务器
【发布时间】:2017-05-03 18:29:58
【问题描述】:

我正在尝试将第三方包(例如 junit )上传到我自己的存储库服务器。

我做了以下事情:
1)在~/.m2/settings.xml中添加了以下内容

<server>
      <id>thirdparty</id>
      <privateKey></privateKey>
      <passphrase></passphrase>
</server>

2) 转到已缓存在我的本地计算机上 ~/.m2/repository/junit/junit/3.8.1 的包

3)发出以下命令将包上传到我的远程存储库

mvn deploy -DaltDeploymentRepository=thirdparty::default::http://localhost:8000/mavenrepository/thirdparty

出现以下错误:

ERROR] The goal you specified requires a project to execute but there is no POM in this directory 
(/Users/myuser/.m2/repository/junit/junit/3.8.1). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/Users/myuser/.m2/repository/junit/junit/3.8.1). Please verify you invoked Maven from the correct directory.
    at 

这个目录下没有pom.xml,但是有一个名为junit-3.8.1.pom的文件

如果我将 junit-3.8.1.pom 重命名为 pom.xml,然后发出上述部署命令,那么一切正常,maven 能够将包部署到我的存储库。

为什么我的命令不起作用?我们如何在不重命名文件的情况下将包部署到我的远程存储库?我是否发出了错误的命令来部署包?

【问题讨论】:

  • 你用什么做仓库管理器?

标签: maven gradle build maven-3 maven-central


【解决方案1】:

默认情况下,maven 期望 pom 文件名为 pom.xml。要使用其他名称,请使用 -f 选项,如下所示:

mvn deploy -DaltDeploymentRepository=thirdparty::default::http://localhost:8000/mavenrepository/thirdparty -f junit-3.8.1-pom.xml

【讨论】:

    猜你喜欢
    • 2016-10-15
    • 1970-01-01
    • 1970-01-01
    • 2019-09-18
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 2021-10-02
    • 1970-01-01
    相关资源
    最近更新 更多