'How to upload Maven packages and build info to Artifactory from Jenkins

I'm a little confused about how this should work.

I have a Jfrog Maven repo. In my Jenkins pipeline I'm just using mvn deploy to deploy to it.

But I want to get build info too.

There is a Jenkins plugin you access in a pipeline like this:

def artifactory = Artifactory.server 'my-jfrog.jfrog.io'
def buildInfo = Artifactory.newBuildInfo()

But then there is also a Maven specific thing: def rtMaven = Artifactory.newMavenBuild()

It looks like if you use newMavenBuild() it runs mvn for you? I don't want that. I'd like to run my own mvn commands but also add Jfrog build info for those package deploys - is this possible? Can I run mvn myself and also create build info for those?



Solution 1:[1]

Here are list of buildinfo's

def artifactory = Artifactory.server 'my-jfrog.jfrog.io'
def buildInfo = Artifactory.newBuildInfo()
def rtMaven = Artifactory.newMavenBuild()
def rtGradle = Artifactory.newGradleBuild()
def rtNpm = Artifactory.newNpmBuild()
def conanClient = Artifactory.newConanClient()
def rtDocker = Artifactory.docker server: server, host: "tcp://<daemon IP>:<daemon port>"

def rtMaven = Artifactory.newMavenBuild() it will create a maven repository and will download all your artifacts from maven automatically and will upload all your artifacts to your artifactory

Please find more information at below doc https://www.jfrog.com/confluence/display/RTF/Scripted+Pipeline+Syntax

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ranga Reddy