2017-05-03 104 views
0

我想将第三方包(例如junit)上传到我自己的资源库服务器。使用maven将第三方包上传到我自己的maven资源库服务器

我做了以下几件事:
1)增加了以下的~/.m2/settings.xml

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

2东西)去的那是alredy在~/.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能够将包部署到我的存储库。

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

+0

你对存储库管理器有什么用? –

回答

1

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

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