[英]Does maven alway deploys maven-metadata.xml file after all uploading artifacts
Is there any order in which maven deploying artifacts? maven 部署工件有什么顺序吗? From what i see i can say that it uploads all artifacts and at last it updates maven-medata.xml files从我所见,我可以说它上传了所有工件,最后它更新了 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 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
Now is it guaranteed that maven always upload this 2 files at last, after uploading other artifacts?现在是否保证 maven 总是在上传其他工件后始终上传这 2 个文件?
Maven always deploys the artifact files in the same sequence. Maven 总是以相同的顺序部署工件文件。 It usually looks something like this:它通常看起来像这样:
[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] ------------------------------------------------------------------------
As you can see, the first thing it does is it attempts to resolve the maven-metadata.xml
file at the artifact level in order to figure out, if this artifact has other versions and whether to generate a brand new maven-metadata.xml
file, or update the existing one, (if there is such), with the new version that it's deploying.如您所见,它所做的第一件事是尝试在工件级别解析maven-metadata.xml
文件,以确定该工件是否有其他版本以及是否生成全新的maven-metadata.xml
文件,或使用它正在部署的新版本更新现有文件(如果有的话)。 The maven-metadata.xml
file is always generated, or updated at the very end of the deployment. maven-metadata.xml
文件总是在部署结束时生成或更新。
There are three levels at which maven-metadata.xml
files can be located: maven-metadata.xml
文件可以位于三个级别:
groupId
/ artifactId
level, (for example, if your groupId
is org.foo.examples
and your artifactId
is hello-world
, the path will be org/foo/examples/hello-world/maven-metadata.xml
).工件级别:这在groupId
/ artifactId
级别,(例如,如果您的groupId
是org.foo.examples
并且您的artifactId
是hello-world
,则路径将为org/foo/examples/hello-world/maven-metadata.xml
)。 This is used for the management of base, or release versions.这用于管理基本版本或发布版本。groupId
/ artifactId
/ version
level, (for example, if your groupId
is org.foo.examples
and your artifactId
is hello-world
and version is 1.0-SNAPSHOT
, the path will be org/foo/examples/hello-world/1.0-SNAPSHOT/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
)。 This is used for the management of timestamped snapshots.这用于管理带时间戳的快照。groupId
level and is used for the management of different plugins under the same plugin group. Plugin group level:这是插件的groupId
级别,用于管理同一插件组下的不同插件。For a very detailed explanation of how Maven metadata works, have a look at this article I've put together.有关 Maven 元数据如何工作的非常详细的解释,请查看我整理的这篇文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.