How to automate work in Jenkins?

I use the Maven Release Plugin to automate the build and release process. It works fine, but one problem that I encountered.

I created a task that checks the trunk every 15 minutes if any changes find that it starts the build and release process. And his work is excellent.

But the small problem is when release:prepare is executed, it creates a tag and automatically increments the version of trunk / pom.xml (with SNAPSHOT) to the next version of the SNAPSHOT version.

Suppose my current build version is 2.0-SNAPSHOT. After successful creation, create a tag of only 2.0 (without SNAPSHOT). It also automatically increases pom.xml inside the trunk to 2.1-SNAPSHOT.

The problem is that when my Jenkins (crontab) checks the trunk every 15 minutes, it detects a new version inside the trunk (i.e. pom.xml). And he again creates a new assembly. This process is repeated again and again. Where I know that there are no code changes in the trunk, only the version is increased using the release:prepare command.

Below I give a Jenkins screen shot for reference.

Jenkins settings

Any help would be greatly appreciated.

Thanks in advance.

0
source share
2 answers

Typically, Maven snapshots trigger changes to the source code, and release builds are created on demand (when the code is released). This is the workflow supported by the Maven release plugin.

It is unclear whether you have installed the Jenkins plugin installed for the release of M2 or not? It provides a convenient β€œRelease” button to initiate the release of assemblies of your work.

+1
source

It seems you set your release goals in the "Goals and Options" section of the standard build section. This determines the assembly that occurs when checking for new code.

You should change the "Goals and Options" to something like clean deploy (which will just deploy the snapshot to the remote repository.

You can then select the "Maven release build" checkbox in the "Build Environment" section. It will be pre-populated with standard release commands. These commands will only be launched when you click the Run Maven Release button on the first page of the task.

enter image description here

0
source

All Articles