2017-05-03 46 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 
相關問題