This article describes detail steps about how to install Gradle and briefly explains how to install fixes via Update Manager using Gradle as an automation tool.
By Harsh Chincholi, Senior Software Engineer, Software AG
Table of Contents
- Install Gradle
- Creating Gradle Script to Install Fixes using Update Manager
This article describes detail steps about how to install Gradle and configure. And briefly explains how to install fixes via Update Manager using Gradle as an automation tool. The script and instructions contained in this article are for webMethods version 10.1 and above on window’s platform.
- Minimum Knowledge of Java and Gradle
- Gradle requires JDK version 6 or later to be installed in the system
- It will certainly help if you have some prior exposure to Groovy
- Gradle carries its own Groovy library; therefore, we do no need to install Groovy explicitly
Download the latest version of Gradle from the Download Gradle link. In the reference page, click on the Complete Distribution link. This step is common for any platform. For this you will get the complete distribution file into your Downloads folder.
Installing Gradle on Windows:
Extract the downloaded zip file named gradle-4.7-all.zip and copy the distribution files from Downloads\gradle-4.7\ to C:\gradle-4.7-all\gradle-4.7 location.
Later, add the C:\gradle-4.7-all\gradle-4.7 and C:\gradle\bin directories to the GRADLE_HOME and PATH system variables. Right-click on My Computer → Click properties → Advanced system settings → Environment variables. There you will find a dialog box for creating and editing system variables. In the Environment Variables dialog the GRADLE_HOME user variable should be set:
Click ‘Edit’ for editing the existing Path system variable. The process is shown in the following screenshot:
Verify the Gradle Installation in Windows:-
You can execute the following command in the command prompt.
C:\> gradle –v
Output − You will find the Gradle version.
Installing Gradle on Linux:
Extract the downloaded zip file named gradle-4.7-all.zip then you will find an extracted file named gradle-4.7.
You can use the following command to move the distribution files from Downloads/gradle-4.7/ to /opt/gradle/ location. Execute this operation from the downloaded directory.
$ sudo mv gradle-4.8 /opt/gradle
Edit the ~/.bashrc file and paste the following content to it and save it.
export ORIENT_HOME = /opt/gradle export PATH = $PATH:
Execute the following command to execute ~/.bashrc file.
$ source ~/.bashrc
Verify the Gradle Installation in Linux:-
You can execute the following command in terminal.
$ gradle –v
Output − You will find the Gradle version.
Build time: 2018-02-08 07:59:16 UTC
Build number: none
Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017
JVM: 1.7.0_60 (Oracle Corporation 24.60-b09)
OS: Linux 3.13.0-74-generic amd64
Creating Gradle Script to Install Fixes using Update Manager:
Having prerequisites in place i.e 10.1 webMethods products and Update Manager installed on a windows machine in separate directories. Gradle is already installed we will proceed with the steps to create Gradle script and install fixes using the script.
Create a folder in any location for example I have created a folder InstallFixes in the location “C:\gradle-4.8\samples\”. In InstallFixes folder create a file with name build.gradle.
Below is the groovy script that will be used in the build.gradle file for installing the fixes.
Details of the above snippet as follows:
Def: It is a keyword which is used to define the local variable. Here the local variable installdir has been assigned the "C:/SAGUpdateManager/" value which is the installation directory of the Update Manager .
Task: It is a keyword which is used to define a task or action the build script. Task named SUM will install the fixes.
Exec: It is task type.
workingDir: The working directory for the process. Defaults to the project directory and here it is “C:/SAGUpdateManager/bin”.
commandLine: Sets the full command line, including the executable to be executed plus its arguments.
Copy the BRT_FixInstall.txt file to the “C:\gradle-4.8\samples\InstallFixes” location. Now the directory structure looks like:
BRT_FixInstall.txt is a script which is created by using UpdateManager and the contents of the script are:
Execute the Groovy script:
Open the command prompt and navigate to “C:\gradle-4.8\samples\InstallFixes” then execute the command “gradle SUM”. Task named SUM will be executed from the file build.gradle using the task Exec.
This Exec will intern trigger the UpdateManger which will install the fixes using the script BRT_FixInstall.txt provided through commandLine present in the build.gradle script.