[英]Jenkins deploying artifacts to Artifactory. maven-metadata.xml shows incorrect version for release and does not show versions for snapshot
I am new to Jenkins and Artifactory and I have been unable to resolve this issue. 我是Jenkins和Artifactory的新手,无法解决此问题。 I am using Jenkins 2.32.1, Artifactory 4.14.0, the Jenkins Artifactory plugin 2.9.0, and Maven 2. I am building using the Jenkins pipeline.
我正在使用Jenkins 2.32.1,Artifactory 4.14.0,Jenkins Artifactory插件2.9.0和Maven2。我正在使用Jenkins管道进行构建。
Here is my jenkinsfile
: 这是我的
jenkinsfile
:
node('default') {
try{
def server = Artifactory.newServer url: 'https://artifactory.com/artifactory', credentialsId: 'MYCREADENTIALS'
def rtMaven = Artifactory.newMavenBuild()
stage('Checkout') {
checkout myProject
}
stage('Artifactory configuration') {
rtMaven.tool = 'Default'
rtMaven.resolver server: server, releaseRepo: 'my-repo-all', snapshotRepo: 'my-repo-all'
rtMaven.deployer server: server, releaseRepo: 'my-repo-local', snapshotRepo: 'my-repo-local'
}
stage('Clean') {
rtMaven.run pom: 'pom.xml', goals: 'clean '
}
stage('Install') {
def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'install '
server.publishBuildInfo buildInfo
}
} catch (err) {
echo "Caught: $err"
currentBuild.result = 'FAILURE'
}
}
My Artifactory repo looks like: 我的Artifactory仓库如下所示:
Here is a snippet from my pom.xml
of the snapshot version: 这是快照版本的
pom.xml
的片段:
<groupId>com.my.group</groupId>
<artifactId>my-project-local</artifactId>
<packaging>jar</packaging>
<version>11-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>my description</description>
Here is the mavan-metadata.xml
: 这是
mavan-metadata.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.my.group</groupId>
<artifactId>my-project-local</artifactId>
<version>11-20170126.182450-1</version>
<versioning>
<latest>11-20170126.182450-1</latest>
<release>11-20170126.182450-1</release>
<versions>
<version>4</version>
<version>5</version>
<version>6</version>
<version>7</version>
<version>8</version>
<version>11-20170126.173903-1</version>
<version>11-20170126.182450-1</version>
</versions>
<lastUpdated>20170126192233</lastUpdated>
</versioning>
</metadata>
My issue is that the maven-metadata.xml
file is listing the snapshot version as its latest release version, and something (Artifactory?) is not recognizing the 11-20170126.182450-1
version is actually a snapshot version. 我的问题是,
maven-metadata.xml
文件将快照版本列为其最新发行版本,并且某些东西(Artifactory?)无法识别11-20170126.182450-1
版本实际上是快照版本。
This creates issues when this repo is listed as a dependency in the pom.xml
of my other projects. 当此存储库在我的其他项目的
pom.xml
中被列为依赖项时,这会产生问题。 When it tries to grab the latest version from this repo, it incorrectly tries to grab the snapshot version (11-...) rather than the release version (8). 当它尝试从该存储库中获取最新版本时,会错误地尝试获取快照版本(11 -...),而不是发行版本(8)。
Thank you in advance! 先感谢您! I appreciate any advice or insight into this problem.
感谢您对这个问题的任何建议或见解。
My question was answered in the comments of my question by @Tunaki. @Tunaki在我的问题评论中回答了我的问题。 I was using ranges in my pom.xml to reference the artifacts from the repository mentioned in my post.
我在pom.xml中使用范围来引用帖子中提到的存储库中的工件。 I switched to using the exact version number and it is working correctly now.
我改用确切的版本号,现在可以正常使用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.