MavenはカスタムjarパッケージをNexusにパブリッシュ


次のコマンドを発行します.
mvn deploy:deploy-file -DgroupId=ddd.util -DartifactId=ddd-util -Dversion=1.0 -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\dddutil.jar -Durl=http://ip:port/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

-DgroupIdプロジェクト
-DartifactIdモジュール
-バージョン番号
-Dpackagingはパッケージ方式です
-Dfileパッケージのローカルパス
-durlは倉庫の住所です.
-DRepositoryId=thirdpartyは、Nexusのどの倉庫にパブリッシュするかです.
ここのidはあなたのnexusのRepositoriesの対応するライブラリのconfigurationのRepositories IDです.次の図を示します.
Maven 发布自定义jar包到Nexus中_第1张图片
時報の発行が間違っています.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default
-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact ddb.util:dd
b-util:jar:1.0 from/to thirdparty (http://ip:port/nexus/content/repositories/thirdpa
rty/): Failed to transfer file: http://ip:port/nexus/content/repositories/thirdparty/ddb/
util/ddb-util/1.0/ddb-util-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

解決策
mavenのconfの下にあるsetting.xmlに追加する必要があります.
<server>
 <id>thirdparty</id>
 <username>  </username>
 <password>  </password>
</server>

ここでidはパブリッシュされたidと一致します.
もう一回でリリースに成功しました.