在所有上传工件之后,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
级别,(例如,如果您的 groupId
是 org.foo.examples
而您的 artifactId
是 hello-world
,路径将为 org/foo/examples/hello-world/maven-metadata.xml
)。这用于管理基础版本或发布版本。
- 版本级别:这在
groupId
/artifactId
/version
级别,(例如,如果您的 groupId
是 org.foo.examples
并且您的 artifactId
是 hello-world
,版本是 1.0-SNAPSHOT
,路径将是 org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml
)。这用于管理带时间戳的快照。
- 插件组级别:插件的
groupId
级别,用于同一插件组下不同插件的管理。
有关 Maven 元数据如何工作的非常详细的解释,请查看我整理的 this article。
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
级别,(例如,如果您的groupId
是org.foo.examples
而您的artifactId
是hello-world
,路径将为org/foo/examples/hello-world/maven-metadata.xml
)。这用于管理基础版本或发布版本。 - 版本级别:这在
groupId
/artifactId
/version
级别,(例如,如果您的groupId
是org.foo.examples
并且您的artifactId
是hello-world
,版本是1.0-SNAPSHOT
,路径将是org/foo/examples/hello-world/1.0-SNAPSHOT/maven-metadata.xml
)。这用于管理带时间戳的快照。 - 插件组级别:插件的
groupId
级别,用于同一插件组下不同插件的管理。
有关 Maven 元数据如何工作的非常详细的解释,请查看我整理的 this article。