简体   繁体   中英

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

Is there any order in which maven deploying artifacts? From what i see i can say that it uploads all artifacts and at last it updates maven-medata.xml files

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 always deploys the artifact files in the same sequence. 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. The maven-metadata.xml file is always generated, or updated at the very end of the deployment.

There are three levels at which maven-metadata.xml files can be located:

  • Artifact level : This at the 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 ). This is used for the management of base, or release versions.
  • Version level : This at the 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 ). This is used for the management of timestamped snapshots.
  • Plugin group level : This is at the plugin's groupId level and is used for the management of different plugins under the same plugin group.

For a very detailed explanation of how Maven metadata works, have a look at this article I've put together.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM