Uploading files from srver to artifactory - bash

I have a local server with some files and each time i run automation these files get updated, i would like to copy these file to a repository in artifactory. The files i have is a zip file
I found ways like CI jenkins integration and a maven artifactory plugin, but i would want something in batch script which i could call in my code.
i'm looking for something like scp <"server_file_path"> <"Location_in the _artifactory"> . I cannot be using the artifactory windows client in my machine. so i need to upload to the artifactory web view path.

You can simply :
use the REST Api
Upload manually
This thread seems to be related :
How to upload an artifact to Artifactory / consume it in a build system (Gradle Maven Ant) where the artifact does not have an extension

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.

Can we use Maven Dependency in Gradle Project Remotely

I am trying to host maven Dependency basically which I can use in Some other Gradle project.
I have also try this locally but I want to do it remotely.
I also try to do this in some other manner - I just host one jar file in tomcat server and tried to download in my gradle project.
"http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar" this is the hosted jar path in which we can eaisly download jar file by hitting this ulr.And "C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar" this is my local .m2 repository.
In this gradle project I can easily download the jar files using compile files ("C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar") but I am not able to download hosted jars i.e - http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar
Can someone give me any idea about this that how can it is possible.
thanks

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.

Maven deploy plugin keep the file name when uploading

I am using maven deploy plugin to upload a file inside bamboo deployment stage. I am uploading the file without pom file. When I upload the file to Nexus, the file name is changing completely. Its appending with project name, version number and build number. I want to keep the filename as it is. Any one know how to do this?
mvn deploy:deploy-file
-Dfile=${bamboo.artifacts.path.artifactFile}
-Dpackaging=cba
-url=https://nexus.internal.organisation.com/content/repositories/snapshots/
-DrepositoryId=snapshots
-DgroupId=com.organisation.art
-DartifactId=myproject
-Dversion=0.0.1-SNAPSHOT
A maven managed repository, such as that provided by Nexus et al, is set up in a way that is intended for deployed products to be returned to a maven build process that has them declared as dependencies.
It is not intended to be a generic file server.
If you have Nexus 3.0 or newer then you have access to so called "raw" repositories that you can set up any way you like.
However you would not use mvn deploy:deploy-file to add files to it. Instead you would follow the instructions in Uploading Files to Hosted Raw Repositories.

Deploy jar files to Archiva manually

I have a lot of jar files in my local hard drive and I want to use them as a repository so that my internet connection requirement can be removed.
I installed Archiva but I don't know how can I deploy the jar files to Archiva. there is a UI form which does this task but deploying huge amount of jar files by hand is not easy and waste a lot of time.
How can I use my local jar files as a repository so that I can use Maven(or Ivy) to manage dependencies?
You can upload them with mvn deploy:deploy-file, which you could use in a script for a bulk upload (discussed here, and here's an example script).
As an alternative, if you want to use those local files directly, you can copy them into the storage location of an Archiva repository. From this thread:
One way to put all your local .m2 repository content is to copy from
~/.m2/repository to
${archiva-install-dir}/data/repository/${managed-repository-name}/
...
Once the copy is done, you can force Archiva d/b scan on the managed
repository.

Resources