What is the preferred way to upload artifacts to A

2019-07-29 01:46发布

问题:

I have a gradle project, and Artifactory as a repository.

I'm a bit confised from the docs, so I ask the experts here: What is the preferred way to upload artifacts to Artifactory? using gradle's uploadArchives, or Artifactory's artifactoryPublish?

Why the uploadArchives is not enough?

ref: upload artifact to artifactory using gradle

回答1:

uploadArchives would of course work but you will be missing out on one of the main reasons you got Artifactory in the first place.

Artifactory's Build Integration (either by standalone build tool or by a CI server running it) is a very powerful tool you should definitely use for tractability of build artifacts and dependencies, license management, release management, and advanced search capabilities which all rely on the build information published by the plugin.

Also you should consider using one of the CI plugins as they offer much much more.



回答2:

The contract of gradles uploadArchives is basically the one of a simple maven or ivy repository. By that I mean, that it basically pushes different kind of artifacts using http or https to artifactory in a very simple manner.

The benefit of the artifactory gradle plugin is, that it allows you to attach way more metadata to the artifacts you publish as it does not rely on the maven repo contract anymore. Furthermore it is quite clever in not uploading same artifacts multiple times by doing checksum comparison.