簡體   English   中英

maven 是否總是在所有上傳工件后部署 maven-metadata.xml 文件

[英]Does maven alway deploys maven-metadata.xml file after all uploading artifacts

maven 部署工件有什么順序嗎? 從我所見,我可以說它上傳了所有工件,最后它更新了 maven-medata.xml 文件

http://localhost:8000/mavenrepository/test1/com/mypackage/mavenproject1/1.0-SNAPSHOT/maven-metadata.xml http://localhost:8000/mavenrepository/test1/com/mypackage/mavenproject1/maven-metadata.xml

現在是否保證 maven 總是在上傳其他工件后始終上傳這 2 個文件?

Maven 總是以相同的順序部署工件文件。 它通常看起來像這樣:

[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ hello-world ---
Downloading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml
Uploading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/hello-world-1.0-20160430.031713-1.jar
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/hello-world-1.0-20160430.031713-1.jar (3 KB at 11.5 KB/sec)
Uploading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/hello-world-1.0-20160430.031713-1.pom
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/hello-world-1.0-20160430.031713-1.pom (2 KB at 41.6 KB/sec)
Downloading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/maven-metadata.xml
Uploading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml (798 B at 21.1 KB/sec)
Uploading: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/maven-metadata.xml
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/foo/examples/hello-world/maven-metadata.xml (312 B at 8.7 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

如您所見,它所做的第一件事是嘗試在工件級別解析maven-metadata.xml文件,以確定該工件是否有其他版本以及是否生成全新的maven-metadata.xml文件,或使用它正在部署的新版本更新現有文件(如果有的話)。 maven-metadata.xml文件總是在部署結束時生成或更新。

maven-metadata.xml文件可以位於三個級別:

  • 工件級別:這在groupId / artifactId級別,(例如,如果您的groupIdorg.foo.examples並且您的artifactIdhello-world ,則路徑將為org/foo/examples/hello-world/maven-metadata.xml )。 這用於管理基本版本或發布版本。
  • 版本級別:這在groupId / artifactId / version級別,(例如,如果您的groupIdorg.foo.examples並且您的artifactIdhello-world並且版本是1.0-SNAPSHOT ,則路徑將為org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml )。 這用於管理帶時間戳的快照。
  • Plugin group level:這是插件的groupId級別,用於管理同一插件組下的不同插件。

有關 Maven 元數據如何工作的非常詳細的解釋,請查看我整理的這篇文章

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM