Using gradle and the jfrog artifactory plugin how can I upload a generic artifact to a generic repository - gradle

I have a special build script that outputs an Alpine APK that I need to upload to a generic Artifactory repository. How do I mark the apk output as an artifact that needs to be picked up and published?

If you're using CloudRepo repository, you could just POST with a curl. You might be able to do this with Artifactory.

Related

Uploading artifacts using Gradle to JFrog Artifactory

After building the Gradle project there is a .jar file is created in build\libs and I want to use it as a JFrog Artifactory and trying to upload to libs-release-local, it looks like this
https://company.jfrog.io/artifactory/libs-release-local/com/abc/xyz/blog-service/v1/
here I can see three files blog-service-v1.jar, blog-service-v1.module, blog-service-v1.pom.
I can manually upload the .jar file and overwrite it from my local to jfrog artifact using
jfrog rt u blog-service-v1.jar
libs-release-local/com/abc/xyz/blog-service/v1/
But where would I get the other two files?
Is it created automatically in jfrog artifact or I have to manually upload it, If I have to manually upload it then where would I get these files?
Thanks
After some changes in build.gradle (click here for more) gradle uploads it to artifactory. All you need to do is run this(gradle artifactoryPublish) from your command line.

Set properties for existing artifact in Artifactory Pro from script

I'm looking for CLI or Rest API command which allows to set (or update?) properties to artifact with specified GAV and repository name. Is it possible?
The artifact shouldn't be uploaded, it's already there (in Artifactory Maven repository).
There you go:
https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-SetItemProperties
Using this REST API you can just add properties on an artifact in Artifactory.

tell maven to get JAR dependency from given URL

Unfortunately, my project has an external dependency that was never published to any Maven repository. The only way I can get it is by direct download from github (they pushed the binary to github).
One (bad) way is to download the jar manually and commit/push it to my code repository (git). It wouldn't help me to manually deploy this artifact in my local binary repository because I share this project with external contributors that cannot access my private binary repo.
I wonder if maven has a better way to handle this? (Given that I can't upload the artifact to my repo or public repo).
I know that npm allows getting some dependencies from URL. Does maven support it as well?
AFAIK there is no nice way to handle this. You could
Write a script that downloads the jar and installs it in your local Maven repository. This script could be shared through your code repository.
Include downloading and installing the artifact into the Maven build process (by writing a Maven plugin or using the antrun plugin)
Set up a nexus in the cloud that everyone in your team can access.

Automatically download missing artifacts if missing in Artifactory

I'm using Jfrog Artifactory to contain artifacts. I'm building with Maven. Is there a way to configure Maven to automatically download missing artifacts, artifacts that are not in the Artifactory repo.
Example:
org.maven.framework-2.5.0 is downloaded from Artifactory since it exists in the Artifactory.
org.maven.anotherframework-2.2.2 doesn't exists in Artifacotry. How to set maven to get from internet?
Is it common to use Artifactory this way?
You should configure Artifactory to fetch missing artifacts from the Internet, not Maven.
Artifactory can (and should) be used as a proxy:
It already comes with set a pre-configured popular remote repositories and you can add new ones.
So, if Maven fails on unresolved dependency, find a repository that has it, add it to Artifactory as remote repository, retry the build. If you can't find any repository that has it, you can upload the jar directly to Artifactory and retry the build.

Trouble publishing rpm artifact to yum snapshot repo using Gradle

I've been trying to publish a rpm file (built using Gradle-custom plugin) to a yum snapshot repo using Gradle (nexus-yum plugin installed on repo). However, the upload fails and I get an error 400. I further understand that this is because my build script is attempting to upload my rpm artifact to a release repo instead of the snapshot repo. It would be great if anyone could share thoughts as to where I could be going wrong ?
Are you specifying the snapshots area of your repo?
The answer to : using gradle to deploy features.xml to nexus? explains how to update your maven settings.xml to exclude locations from a public repo and upload archives to releases area (same applies for snapshot)
Of course if you are publishing to a snapshot dir you must have a -SNAPSHOT extension.

Resources