简体   繁体   English

如何从 jenkins 上传 maven 包并将信息构建到工件

[英]How to upload maven packages and build info to artifactory from jenkins

Im a little confused about how this should work.我对这应该如何工作感到有点困惑。

I have a jfrog maven repo我有一个 jfrog maven 回购

Right now in my jenkins pipeline Im just using mvn deploy to deploy to it现在在我的 jenkins 管道中,我只是使用mvn deploy来部署它

But i want to get build info too.但我也想获得构建信息。

There is a jenkins plugin you access in a pipeline like this:您可以在这样的管道中访问 jenkins 插件:

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()但是还有一个 maven 具体的东西: def rtMaven = Artifactory.newMavenBuild()

It looks like if you use newMavenBuild() it runs mvn for you?看起来如果您使用newMavenBuild()它会为您运行 mvn? I dont want that.我不想要那个。 I'd like to run my own mvn commands but also add jfrog build info for those package deploys- is this possible?我想运行我自己的 mvn 命令,但还要为那些 package 部署添加 jfrog 构建信息 - 这可能吗? Can I run mvn myself and also create build info for those?我可以自己运行 mvn 并为它们创建构建信息吗?

Here are list of buildinfo's以下是 buildinfo 的列表

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 def rtMaven = Artifactory.newMavenBuild() 它将创建一个 maven 存储库,并将自动从 maven 下载所有工件并将所有工件上传到您的工件

Please find more information at below doc https://www.jfrog.com/confluence/display/RTF/Scripted+Pipeline+Syntax请在下面的文档https://www.jfrog.com/confluence/display/RTF/Scripted+Pipeline+Syntax中找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM