I have a non maven project whose binaries get deployed to Nexus.
I used gradle's maven plugin to create the artifacts and publish it to Nexus
Now, the trouble is how do I promote this artifacts to release in Nexus? I tried looking up the M2 release plugin for jenkins but it looks for the pom file in my source code.
There are a number of Gradle examples including usage with the Nexus staging suite in the Nexus book examples and eval guide.
Related
I would like to set up a Maven repository with Artifactory.
What are the steps to setup Maven plugins repo in Artifactory. I have to load Maven Jacoco plugin from Artifactory local repo.
Seems your use case can be achieved with general instructions of Maven Repository of Artifactory. Since, you would like to deploy maven type package/plugins, there would no difference in the setup.
We should be able resolve the deployed packages/plugins from maven clients without any issues. Is there anything difference in the use case?
Is this possible? Suppose I have 2 jobs. One for building artifact and upload it to artifactory with latest version. And another job to deploy the artifact to the server. But I would like to choose the artifact version. Supose A deploy was made and not working , so I redeploy and choose previous artifact (or the one I want to choose). Is this posible in jenkins in a pipleine project? Like a parametrized build or something like that.
Thanks
It will work with the pipelin job . I am it in pipeline job only.
Example: https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin
Assume that you have 2 jobs .
Job A & Job B. (Both pipeline jobs.)
Job A -> Build and push the artifacts to Artifactory.
Job B -> Fetch the artifact from Artifactory and deploy.
Install the Maven Meta Plugin . https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin
go to Job B
"This build is parametrerized" checkbox, from the drop-down that appears select the "List maven artifact versions",
configure the artifact you want to retrieve the versions
Name the parameter as deploy_version
In Job B - > Select the version & Click Build.
In pipeline script receive the selected version as param.deploy_version.
Since you know the artifact version and artifact URLs . You can use CURL/httprequest plugin in Jenkisn to download the necessary
artifact from Artifactory (I am using Maven Ansible artifactory
plugin to download)
Continue with your deployment.
According to this answer :
https://stackoverflow.com/a/34781604/3957754
The artifactory plugin for Jenkins has the option to "resolve" artifacts, i.e. download them from Artifactory. But this may require the Pro version with payment $_$
Download artifact using artifactory jenkins plugin (With Payment)
Configure your artifactory plugin
https://medium.com/#anusha.sharma3010/integrating-jenkins-with-artifactory-6d18974d163d
https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in
In resolve section, you could download your artifacts
Download artifact using commandline and maven
configure maven and artifactory authentication
https://docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/
https://blog.bosch-si.com/developer/setting-up-maven-and-artifactory/
download artifact from artifactory
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-DrepoUrl=http://my_artifactory-url.com \
-Dartifact=groupId:artifactId:version
Source: How can I download a specific Maven artifact in one command line?
I have jenkins jobs that builds ios and android app and i want jenkins to upload those artifact to nexus after build is done.Is there any way to do it?
Thanks
If you are building the apps with Maven or Gradle or whatever (esp. the Android ones) a simple mvn deploy or gradle uploadArchives will do the trick. Same applies if you build the ios app with one of these tools.
In most other cases you can always do normal upload via the REST API.
Examples for the Maven and Gradle setup are in the eval guide and the examples to the Nexus book.
Use the Nexus Artifact Uploader Plugin, and set up a new job where you set a build step to Copy artifacts form another project, and a step to Upload artifact to Nexus
I have a Java project, building with Gradle, using the Jenkins CI server, and I would like to publish to an Artifactory server, using Maven-compatible artifacts. The project is using Git. I would also like to use the release management features of Jenkins if possible.
This is very confusing. There are at least five plugins, with much overlapping redundant functionality. Some plugins seem to replace others. Some plugins seem to require others.
FYI, the five relevant plugins seem to be:
1) Jenkins Artifactory Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin
2) Gradle "maven" Plugin
http://www.gradle.org/docs/current/userguide/maven_plugin.html
3) Gradle "maven-publish" Plugin
http://www.gradle.org/docs/current/userguide/publishing_maven.html
4) Gradle "artifactory" Plugin
https://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin
5) Gradle "artifactory-publish" Plugin
http://www.jfrog.com/confluence/display/RTF/Gradle+1.6+Publishing+Artifactory+Plugin
What is the best way to set this up?
If I use the Jenkins Artifactory Plugin with none of the other plugins mentioned, I get an error:
No publish configurations specified for project ':' and the default 'archives' configuration does not exist.
Cannot publish pom for project ':my-great-app' since it does not contain the Maven plugin install task and task ':my-great-app:artifactoryPublish' does not specify a custom pom path.
I assume I need to use either maven or maven-publish in build.gradle?
maven-publish is labeled as the incubating successor to the maven plugin. How much better is it? How stable is it?
How does using one of the Gradle Artifactory plugins compare to the standard maven publishing plugins vs using the Jenkins plugin?
Gradle Artifactory plugins: Gradle can deploy build artifacts and build information directly, without need in CI server by using one of the Artifactory plugins.
artifactory plugin works with maven plugin and publishes configurations, generated by maven plugin.
artifactory-publish plugin works with maven-publish plugin and publishes publications generated by maven-publish plugin.
Jenkins Artifactory plugin works in two modes:
Providing a UI to override settings, specified in artifactory or artifactory-publish plugins in Gradle build script.
Adding and configuring artifactory plugin to the Gradle script if it is not there.
It also provides release management (for both modes).
So, here's what you need to decide:
Whether you use one of the Gradle plugins. Our recommendation is - use it (versioned configuration in build script is an advantage comparing to UI-only configuration.
Which plugin you want to use -- maven or maven-publish. While the later is still 'incubating', it is much more flexible than the former. Once you know with which maven plugin you want to use, select the appropriate artifactory plugin.
You need the Artifactory Jenkins plugin in either way if you want to use the release functionality, just check (or uncheck) the 'Project uses the Artifactory Gradle Plugin' checkbox.
So I got few separated jobs in Jenkins. The first one gets the project from a Git repository, builds it and produces artifacts. And another one has to copy certificates from the first job and publish them to Artifactory (tried to make it using the Artifactory plugin). But the thing is that the Artifactory plugin's available only in the Build job, there's nothing like "Generic-Artifactory integration" in second job's configuration.
Does anyone know what are the requirements for making the plugin work in the Publish job?
You can write a small shell script leveraging Artifactory REST API and execute it in your second, non-build job.
I have done a similar thing with maven and a zip file. I have deployed a zip with a build step in maven calling a deploy:deploy-file and setting my Artifactory repository in settings.xml and deploying directly on my artifactory repository.