Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Artifactory Plugin (gradle) doesn't read version from gradle.properties

Currently I try to configure Jenkins, so I can do my release builds automatically. It should change the version number from SNAPSHOT to a release version, and do all the SVN commit stuff. After this is done, it should switch it back to a new SNAPSHOT version and commit it, too. Before I switched from maven to gradle, the same plugin worked correctly.

I already created a gradle build, that works correctly. It is reading the version from the property "version" in the gradle.properties file. This version is the one that is used in the gradle build. It's also possible to run "artifactoryPublish" to publish the JAR to my artifactory.

The problem:

When I open the dialog "Artifactory Pro Release Staging" (http://imgur.com/T44BtQB) it is not filling the fields "Release version", "Next development version", and none of the other fields. If I fill the fields by hand, everything is working correctly. As well the version in gradle.properties is changed and checked in correctly.

How could I solve this problem?

Used Versions:

  • Jenkins Version 2.7.1
  • JFrog Artifactory 4.7.4 rev 40169 (free version)
  • Jenkins Artifactory Plugin 2.6.0 (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Artifactory+Plugin+-+Release+Management)
  • Gradle 2.14.1

Thanks!

like image 620
Markus Mangei Avatar asked Aug 19 '16 10:08

Markus Mangei


People also ask

How to configure Artifactory in gradle?

In the Artifact Repository Browser of the Artifacts module, drill down in the repository tree and select a relevant artifact. Under the Dependency Declaration section, select Gradle to display the corresponding dependency declaration that you can copy into your build. gradle file.

Does Jenkins support gradle?

Gradle provides integration with several development tools and servers, including Eclipse, IntelliJ, Jenkins, and Android Studio.

How do I run a gradle command in Jenkins?

Create a Jenkins jobFrom the left navigation bar select "New Item > Freestyle project". Enter a new name for the project. We'll pick "gradle-site-plugin" for the project. Select the radio button "Git" in the section "Source Code Management".


1 Answers

According to your description, when you access the "Artifactory Release Staging" page, the "Release version" and "Next development version" fields are empty. This might be because you did not define the property names for your version and next development version in your Jenkins job configuration. Here's how you do it: 1. Open your gradle.properties file and find the name of your version property. For example, if your gradle.properties contains: version=1.2-SNAPSHOT then the name is "version". 2. Open your Jenkins job configuration, and put "version" in the "Release property" and "Next development properly" text fields. You should find them under the "Release Staging" configuration.

Now, the Artifactory Release Staging page should know where to take your versions from. This configuration is not required when using Artifactory Release Staging for Maven, because in Maven the version can be found at one place only - in the pom file.

Hope this helps

like image 55
Eyal Ben Moshe Avatar answered Sep 30 '22 18:09

Eyal Ben Moshe