如何在使用Git(lab)时,使用Maven的'maven-release-plugin'对简单项目执行“发布”操作?
我正在开发/功能分支上工作,并最终将更新合并到“主”分支中。我猜想,然后“发布”插件就会发挥作用。是这样吗?
在我的Jenkinsfile中,我调用:
sh 'mvn release:prepare release:perform'
在尝试多种选项时,我一直遇到这个错误:
The svn command failed.
[ERROR] Command output:
[ERROR] svn: E155007: '..workspace/project/pom.xml' is not a working copy
失败的命令是:
[INFO] Executing: /bin/sh -c cd /var/jenkins_home/workspace/jenkins-testing-releasing && svn --non-interactive commit --file /tmp/maven-scm-1557766606.commit --targets /tmp/maven-scm-8208798121252708517-targets
[INFO] Working directory: /var/jenkins_home/workspace/jenkins-testing-releasing
很奇怪,因为我不使用SVN。
这是我目前的情况:
<project ...
<artifactId>jenkinstesting</artifactId>
<version>0.1-SNAPSHOT</version>
<scm>
<connection>scm:git:git@gitlab.com:user/project.git</connection>
<developerConnection>scm:git:git@gitlab.com:user/project.git</developerConnection>
<tag>rel1</tag>
</scm>
版本1:
<build>
<plugins ...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>perform</goal>
</goals>
<configuration>
<pomFileName>pom.xml</pomFileName>
</configuration>
</execution>
</executions>
</plugin>
版本 2:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>