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个文件吗?
答案 0 :(得分: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
文件,以便弄清楚,如果此工件具有其他版本以及是否生成全新的{{ 1}}文件,或使用它正在部署的新版本更新现有文件(如果有的话)。 maven-metadata.xml
文件始终在部署的最后生成或更新。
可以找到maven-metadata.xml
个文件的三个级别:
maven-metadata.xml
/ groupId
级别(例如,如果您的artifactId
为groupId
而您的org.foo.examples
为{{1} }},路径为artifactId
)。这用于管理基本版本或发行版本。hello-world
/ org/foo/examples/hello-world/maven-metadata.xml
/ groupId
级别(例如,如果您的artifactId
为version
且您的{{1} } {是groupId
,版本为org.foo.examples
,路径为artifactId
)。这用于管理带时间戳的快照。hello-world
级别,用于管理同一插件组下的不同插件。有关Maven元数据如何工作的非常详细的解释,请查看我放在一起的this article。