Trigger jenkins build (maven) only if version not in nexus - jenkins

I'd like to trigger Jenkins build only if version specified in pom.xml is not available in my nexus repository. Any help appreciated :)
I could disallow nexus to overwrite existing version, but it is currently not an option

Related

Jenkins Artifactory Plugin Option

I am not able to discard the old artifacts using artifactory plugin in Jenkins. Is there a way that, we can discard the old artifacts from Jenkins itself.
Note :- I am already using Jenkins artifactory plugin but I am not able to discard it via that.
Jenkins Version: 2.3
I tried deleting from Jenkins but I am not able to delete that.
I am expecting that old artifacts gets deleted because we are having discard old builds option available in Jenkins artifactory plugin.

Is there a way to upload only release version to nexus

I am new to Jenkins. I am running my jobs using Jenkins declarative pipeline. My jobs has both snapshot version and release version. I want to push only release version to nexus (the reason is just to make sure it is not very much crowded in nexus). Can i control this in my pipeline script something like running multiple steps like, if my pom version has SNAPSHOT version, don't run nexus stage and if my pom has release version run nexus stage. is it possible to control this scenario in Jenkins pipeline. please assist
Depending on how you know is a SNAPSHOT or a RELEASE version. For example if you use git branches (develop = SNAPSHOT , master = RELEASE) you can use GIT_BRANCH variable in order to select if you must deploy push to nexus
If you must read it directly from pom.xml, read this:
Extract version ID from POM in a Jenkins pipeline
There you get the version and select if is a SNAPSHOT or RELEASE and the upload the file acoordingly.
Hope it helps

Nexus integration with Jenkins

Is there a way to list all the version uploaded in Nexus repositories.
I am working with Jenkins, and trying to show the versions uploaded in Nexus repositories.
EDIT:
I am not using MAVEN releases, i have the compresses files as zip.
The format we have is ,
ABCD releases
com.abc.abcd
appname
v1.0.0
app_v1.0.0.zip
How do i use Repository connector /Artifact resolver to configure to list all the releases under ABCD releases.
yes with jenkins nexus plugin you can make a parametrized job to display a specific version before the job start.
more detail look at this page
https://wiki.jenkins-ci.org/display/JENKINS/Repository+Connector+Plugin

Jenkins & Artifactory

On a server running ubuntu 12.04 I have installed jenkins 1.532.1 and artifactory 2.6.4.
Both of then are running fine separately. I also have maven 2.
With jenkins, I can build maven java project with sources on subversion.
With maven I can use Artifactory.
The problem is with the artifactory plugin for jenkins.
I added an artifactory server with credentials. Using connection check tell me : "Found Artifactory 2.6.4". It seems to be ok.
But when I create a maven job, in post build actions, I choose Deploy artifacts to artifactory. My server is already selected in the artifactory server but nothing is available in the repositories.
What can I do. Do I have to configure something special in Artifactory ?
I had also this issue, the problem comes from a refresh of Jenkins Plugin.
To deal with that issue, you should:
open your job
add a task for artifactory
save your job
Open again your job
Now you should be able to see your repositories.
Conclusion: You should add/save and reload your job to see your list of repo of artifactory.
I also have this problem, when switching from one artifactory server to another and it looks like a bug for me.
But if I save the settings once without a "non-selectable" repository and access the configuration of the job again, the repositories will be shown.
Ok, so after a very long time I tried again and ... I don't know why but now (I'm quite sure it was not working few months ago) the solution given by aorfevre and user3424040 are working.
I have also upgraded jenkins to 1.565.1 and the artifactory plugin to 2.2.3 and now there is a Refresh Repositories button in the Deploy artifacts to Artifactory task.
For the "Generic-Artifactory Integration" I had to configure Artifactory a bit. I added a group 'deployers' and a user 'deploy' in that group. Also I added a Permission Target for the LOCAL repositories where the group was granted deploy permissions.

From where I can download Jenkins build-pipeline-plugin?

I am trying to find location from where I can download the latest release of Jenkins build
pipeline plugin https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin but am
unable to do so. I checkout out the code and build it on my system but when I installed the
plugin it does not show me the view option for build pipeline. It would be helpful if you can
help me find the location of plugin?
Check out the download server of Jenkins. There you will find all the downloads available for both Jenkins releases as well as plugins:
http://mirrors.jenkins-ci.org/plugins/build-pipeline-plugin/latest/

Resources