### Install All Configured Features Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example demonstrates how to configure the Liberty Gradle plugin to install all features that are defined in the server's `server.xml` file. It requires accepting the license. ```Groovy /* Install all features configured by the server */ apply plugin: 'liberty' liberty { server { features { acceptLicense = true } } } ``` -------------------------------- ### Install Liberty Runtime from a Specific URL (ZIP) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Installs the Liberty runtime from a specified URL pointing to a ZIP archive. ```gradle apply plugin: 'liberty' liberty { install { runtimeUrl="" } } ``` -------------------------------- ### Install Liberty from JAR Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md This snippet demonstrates how to install the Liberty runtime from a JAR file. It requires executing a Java command to process the runtime archive and view license information, which includes the license code. ```bash java -jar wlp*runtime.jar --viewLicenseInfo ``` -------------------------------- ### Install Liberty Runtime from a Specific URL (JAR) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Installs the Liberty runtime from a specified URL pointing to a JAR file, requiring a license code. ```gradle apply plugin: 'liberty' liberty { install { licenseCode = "" runtimeUrl = "" } } ``` -------------------------------- ### Install Liberty Runtime with Java EE 7 Features Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Configures the plugin to install the Liberty runtime with all Java EE 7 features using the Liberty repository. ```gradle apply plugin: 'liberty' liberty { install { type = "javaee7" } } ``` -------------------------------- ### Install Multiple Features Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example shows how to install multiple features, 'mongodb-2.0' and 'adminCenter-1.0', simultaneously using a single configuration block in the Liberty Gradle plugin. The license must be accepted. ```Groovy /* Install 'mongodb-2.0' and 'adminCenter-1.0' features using a single block. */ apply plugin: 'liberty' liberty { server { features { name = ['mongodb-2.0', 'adminCenter-1.0'] acceptLicense = true } } } ``` -------------------------------- ### Configure Liberty License Installation in Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md This Gradle configuration snippet shows how to add a Liberty license JAR file as an artifact and publish it to a Maven local repository. This process is equivalent to using the Maven install plugin and prepares the license for use in Liberty tasks. ```Gradle apply plugin: 'maven' apply plugin: 'maven-publish' def licenseFile = file('wlp-core-license.jar') artifacts { archives licenseFile } publishing { publications { licenseArtifact(MavenPublication) { groupId = 'com.ibm.websphere.appserver.license' artifactId = 'wlp-core-license' version = '19.0.0.9' artifact licenseFile } } } ``` -------------------------------- ### Groovy Integration Test Example Source: https://github.com/openliberty/ci.gradle/blob/main/docs/addingTests.md An example Groovy test class demonstrating the structure and methods required for integration testing within the Open Liberty CI Gradle project. It includes setup for test directories, copying build files, and running specific Gradle tasks. ```Groovy package io.openliberty.tools.gradle; import java.io.File; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class YourAwesomeTest extends AbstractIntegrationTest{ // location of the directory containing the files need to run your test build // test resources are added in the root_dir/src/integTest/resources/ directory static File resourceDir = new File("build/resources/integrationTest/your-awesome-build-files") // **required** // directory from which your build will take place // you only must configure the second parameter of the below file instantiation static File buildDir = new File(integTestDir, "/your-awesome-test") // **required** // the name of the build file you are using in the root directory of the resources you are using static String buildFilename = "YourAwesomeTest.gradle" // **required** @BeforeClass // this method configures the setup for your test build public static void setup() { // **required** // create the directory you will be building out of createDir(buildDir) // **required** // copy your testing resource into your build directory as // well as your needed .gradle files. createTestProject(buildDir, resourceDir, buildFilename) // **required** } // Any configuration you need to run after your test suite // Hint: Stop any running servers here. Running servers may cause other test suites to fail @AfterClass public static void tearDown() throws Exception { runTasks(buildDir, 'libertyStop') } @Test public void your_awesome_test() { try { runTasks(buildDir, 'yourAwesomeTask') } catch (Exception e) { throw new AssertionError ("Fail on task yourAwesomeTask.", e) } } } ``` -------------------------------- ### Install Liberty License JAR using Maven Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md This command demonstrates how to install a Liberty license JAR file into a local Maven repository using the Maven install plugin. This is a prerequisite for upgrading the runtime license during CI builds. ```bash mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=wlp-core-license.jar ``` -------------------------------- ### Install WebSphere Liberty Features from Dependencies Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example shows how to install WebSphere Liberty features, like 'servlet-3.0' and 'localConnector-1.0', by defining them as dependencies in Gradle. It also includes the necessary configuration to accept licenses for the server features. ```Groovy apply plugin: 'liberty' dependencies { libertyFeature 'com.ibm.websphere.appserver.features:servlet-3.0:18.0.0.2' libertyFeature 'io.openliberty.features:localConnector-1.0:18.0.0.2' } liberty { server { features { acceptLicense = true } } } ``` -------------------------------- ### Install Open Liberty Features from Dependencies Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example illustrates installing Open Liberty features, such as 'jaxrs-2.1' and 'jsonp-1.1', by declaring them as dependencies in the Gradle build. It specifies the feature coordinates and version. ```Groovy apply plugin: 'liberty' dependencies { libertyFeature 'io.openliberty.features:jaxrs-2.1:18.0.0.2' libertyFeature 'io.openliberty.features:jsonp-1.1:18.0.0.2' } ``` -------------------------------- ### Configure Liberty Server Installation Directory Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Sets the path to a pre-installed Liberty server. This allows using an existing Liberty installation instead of downloading a new one. It can be configured in the `gradle.properties` file or from the command line. ```Gradle liberty { installDir = "/opt/IBM/Liberty" } ``` -------------------------------- ### Build Open Liberty Gradle Plugin Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Command to build the Open Liberty Gradle plugin and install it into the build\libs directory. It also shows how to install the plugin into the local Maven repository. ```Bash $ ./gradlew build ``` ```Bash $ ./gradlew install ``` -------------------------------- ### Install Open Liberty Beta Runtime Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Configures the Liberty Gradle Plugin to install a beta version of the Open Liberty runtime using a Maven artifact. This is achieved by specifying the `libertyRuntime` dependency with the appropriate group, name, and version. ```groovy dependencies { libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '25.0.0.7-beta' } ``` -------------------------------- ### Install Single MongoDB Feature Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example demonstrates how to install a single feature, 'mongodb-2.0', to your default server configuration using the Liberty Gradle plugin. It requires accepting the license for the feature. ```Groovy apply plugin: 'liberty' liberty { server { features { name = ['mongodb-2.0'] acceptLicense = true } } } ``` -------------------------------- ### Configure Liberty Runtime Installation Directory Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Sets the base directory for Liberty server installations. The actual installation path will be `${baseDir}/wlp`. This property can also be overridden via `gradle.properties` or the command line. ```Gradle liberty { baseDir = "/path/to/liberty/base" } ``` -------------------------------- ### Override Liberty Installation Directory Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Specifies how to override the default Liberty installation directory using gradle.properties or command line arguments. ```properties liberty.installDir= ``` ```bash gradle build -Pliberty.installDir= ``` -------------------------------- ### Install User Feature with Signature Verification Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md This example shows how to install a user-defined feature using its short name or symbolic name. It includes specifying the feature BOM, accepting the license, and verifying the feature's signature using public keys. ```Groovy dependencies { featuresBom 'my.user.features:features-bom:1.0' } liberty { server { features { name = ['myUserFeature-1.0'] acceptLicense = true verify = 'all' } keys = ['0x05534365803788CE':'https://keyserver.ubuntu.com/pks/lookup?op=get&options=mr&search=0x05534365803788CE'] } } ``` -------------------------------- ### Build and Install LGP Locally Source: https://github.com/openliberty/ci.gradle/wiki/Home Command to build the Liberty Gradle Plugin (LGP) locally and install it, with an option to skip tests for a faster build. ```bash ./gradlew install -x test ``` -------------------------------- ### Gradle: Start dev mode and skip feature installation Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty dev mode and configures the `skipInstallFeature` property. If set to true, the `installFeature` task is skipped during dev mode startup or server restarts, unless feature changes are detected. ```gradle $ gradle libertyDev --skipInstallFeature=true ``` ```groovy liberty { dev { skipInstallFeature=true } } ``` ```groovy ext { liberty.dev.skipInstallFeature=true } ``` -------------------------------- ### Install WebSphere Liberty Runtime Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Configures the Liberty Gradle Plugin to install a WebSphere Liberty runtime from a Maven artifact. This involves specifying the `libertyRuntime` property with the `com.ibm.websphere.appserver.runtime` group and the required name and version for WebSphere Liberty. ```groovy dependencies { libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-webProfile8', version: '25.0.0.6' } ``` -------------------------------- ### Open Liberty Gradle Configuration Parameters Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Details the configuration parameters for the Open Liberty Gradle plugin. Includes 'timeout' for server startup waiting time, 'var' for inline server variables, and 'verifyAppStartTimeout' for application start verification in logs. ```Gradle timeout: String (default: 30 seconds) var: Properties verifyAppStartTimeout: int (default: 0 seconds) ``` -------------------------------- ### Configure libertyStart Task in Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyStart.md This snippet demonstrates how to configure the `libertyStart` task within a Gradle build file. It shows how to set the server name, enable cleaning of server artifacts before startup, and configure a timeout for application start verification. ```groovy apply plugin: 'liberty' liberty { server { name = 'myServer' // Clean logs, workarea, apps, dropins on server startup clean = true // Wait 30 seconds to verify application start verifyAppStartTimeout = 30 } } ``` -------------------------------- ### Configure Liberty Runtime Dependency Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Specifies how to declare Liberty runtime dependencies using the 'libertyRuntime' configuration in Gradle. It shows different formats for defining the group, name, and version. ```gradle dependencies { libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-webProfile8', version: '19.0.0.9' libertyLicense 'com.ibm.websphere.appserver.license:wlp-core-license:19.0.0.9' } ``` ```gradle libertyRuntime 'com.ibm.websphere.appserver.runtime:wlp-webProfile8:19.0.0.9' ``` ```gradle libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-webProfile8', version: '19.0.0.9' ``` ```gradle libertyRuntime( [group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-webProfile8', version: '19.0.0.9'] ) ``` -------------------------------- ### Install User Features using Gradle with featuresBom Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md Shows how to install custom user features using the 'featuresBom' dependency configuration. This approach requires a 'prepareFeature' task to generate a 'features.json' file, which is then used by installFeature. ```gradle dependencies { featuresBom 'com.ibm.websphere.appserver.features:user-features-bom:1.0@json' } ``` -------------------------------- ### Start Liberty in Dev Mode (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md The libertyDev task starts a Liberty instance in development mode. It automatically invokes libertyCreate, installFeature, and deploy tasks before starting the runtime. This task is designed for direct execution from the Gradle command line and supports hot-reloading of code changes. ```gradle gradle libertyDev ``` -------------------------------- ### Override Default Runtime Configuration Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Demonstrates how to override the default Liberty runtime artifact using the 'liberty.runtime' property in build.gradle, gradle.properties, or via command line arguments. ```gradle liberty { runtime = ['group':'io.openliberty','name':'openliberty-javaee8'] } ``` ```properties liberty.runtime.name=wlp-javaee8 liberty.runtime.version=19.0.0.11 ``` ```bash gradle build -Pliberty.runtime.version=19.0.0.11 ``` -------------------------------- ### Configure Liberty License Dependency in Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Defines the coordinates for the Liberty license JAR file, enabling the installLiberty task to upgrade the license if this configuration is present. Requires the 'liberty' plugin and a local Maven repository. ```gradle apply plugin: 'liberty' repositories { mavenLocal() } dependencies { libertyLicense 'com.ibm.websphere.appserver.license:wlp-core-license:19.0.0.9' } ``` -------------------------------- ### Install WebSphere Liberty Features using Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md Illustrates configuring the installFeature task to install WebSphere Liberty features. This involves using the 'libertyFeature' dependency configuration with the group 'com.ibm.websphere.appserver.features' and specifying the feature details. ```gradle dependencies { libertyFeature 'com.ibm.websphere.appserver.features:webSphereLiberty-all@jar' } ``` -------------------------------- ### Start Liberty Dev Mode (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty development mode using the `libertyDev` task. This task enables hot deployment of changes within the Gradle project. ```Shell $ gradle libertyDev ``` -------------------------------- ### Install Specific Open Liberty Runtime Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Configures the Liberty Gradle Plugin to install a specific version of the Open Liberty kernel runtime using a Maven artifact. The `libertyRuntime` property is used to define the group, name, and version of the desired Open Liberty kernel. ```groovy dependencies { libertyRuntime group: 'io.openliberty', name: 'openliberty-kernel', version: '25.0.0.6' } ``` -------------------------------- ### Install Features from server.xml using Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md Explains how to install features declared in the server.xml file, including its include elements and configDropins. This method is applicable for Liberty runtime versions 18.0.0.2 and above. For older versions (18.0.0.1 and below), setting acceptLicense to true without a name attribute is required. ```gradle tasks.installFeature { acceptLicense true } ``` -------------------------------- ### Install Open Liberty Features using Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installFeature.md Demonstrates how to configure the installFeature task to install Open Liberty features using the 'libertyFeature' dependency configuration. This requires specifying the group 'io.openliberty.features' along with the feature name and version. ```gradle dependencies { libertyFeature 'io.openliberty.features:webProfile-8.0@jar' } ``` -------------------------------- ### Podman VM Reinitialization for Permissions Issues Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Outlines the steps to reinitialize a Podman VM if permission issues persist, including stopping the machine, specifying the machine name, initializing with rootful mode, and starting the machine. ```bash podman machine stop podman machine podman machine init --rootful=true podman machine start ``` -------------------------------- ### Add Custom Maven Repository in Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/installLiberty.md Configures a custom Maven repository within your Gradle build. This allows Gradle to fetch artifacts from a specified URL, optionally with authentication credentials. Refer to Gradle documentation for detailed repository configuration. ```gradle repositories { maven { name 'Your Custom Repository' url 'https://your-url-here.me' credentials { username '' password '' } } } ``` -------------------------------- ### Configure Liberty Server in Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyRun.md An example of configuring the Liberty server within a Gradle build script. This includes setting the server name and enabling the clean option. ```groovy apply plugin: 'liberty' liberty { server { name = 'myServer' clean = true } } ``` -------------------------------- ### Podman VM Configuration for Rootful Mode Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Provides commands to configure Podman VMs to run in rootful mode, which may be necessary depending on container permissions. This includes stopping, setting rootful mode, and starting the Podman machine. ```bash podman machine stop podman machine set --rootful=true podman machine start ``` -------------------------------- ### Run Liberty Server with Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyRun.md Starts a Liberty server using the 'libertyRun' Gradle task. It's recommended to use the '--no-daemon' option for proper shutdown handling when terminating the task with Ctrl-C. ```gradle gradle libertyRun --no-daemon ``` -------------------------------- ### Package Minified ZIP Archive with libertyPackage Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyPackage.md This example demonstrates how to configure the libertyPackage task to create a minified ZIP archive for a Liberty server. It specifies the package name and includes only the 'minify' content. ```groovy apply plugin: 'liberty' liberty { server { name = 'myServer' packageLiberty { packageName = "MyPackage" include = "minify" os = "Linux" } } } ``` -------------------------------- ### Package Runnable JAR File with libertyPackage Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyPackage.md This example shows how to package a Liberty server into a runnable JAR file using the libertyPackage task. It sets the 'include' property to 'runnable', enabling execution via the 'java -jar' command. ```groovy apply plugin: 'liberty' liberty { server { name = 'myServer' packageLiberty { packageName = "MyPackage" include = "runnable" } } } ``` -------------------------------- ### Build and Test Open Liberty Gradle Plugin Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Commands to build the plugin, run integration tests, and optionally include DevContainerTests. Parameters like runtime, runtimeVersion, and wlpLicense are used to configure the Liberty runtime for testing. ```Bash $ ./gradlew install check -Druntime= -DruntimeVersion= -DwlpLicense= ``` ```Bash $ ./gradlew install check -P"test.include"="**/DevContainerTest*" -Druntime= -DruntimeVersion= -DwlpLicense= ``` -------------------------------- ### Start Liberty Dev Mode with Custom Debug Port (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty development mode and allows attaching a debugger to a specific port. The default debug port is 7777, but this example shows how to configure a custom port. ```Shell $ gradle libertyDev --libertyDebugPort=8787 ``` -------------------------------- ### Display Open Liberty System Information Source: https://github.com/openliberty/ci.gradle/blob/main/src/test/resources/dev-test/dev-container-loose-app-false/src/main/webapp/index.html This snippet displays the Open Liberty version, system properties, metrics, health status, and configuration properties. It's designed to be called in sequence to provide a comprehensive overview of the running microservice. ```Java displayLibertyVersion(); displaySystemProperties(); // this calls displayMetrics() because it is a dependency displayHealth(); displayConfigProperties(); ``` -------------------------------- ### Open Liberty Gradle Plugin Tasks Overview Source: https://github.com/openliberty/ci.gradle/blob/main/README.md This section lists and describes the tasks provided by the Open Liberty Gradle plugin. These tasks cover a range of functionalities including server management, application deployment, and feature handling. ```Gradle cleanDirs: Cleans the Liberty server logs, workarea, and applications folders. compileJsp: Compiles the JSP files from the src/main/webapp directory into the build/classes directory. deploy: Deploys one or more applications to a Liberty server. generateFeatures: Scan the class files of an application and create a Liberty configuration file in the source configuration directory that contains the Liberty features the application requires. installFeature: Installs an additional feature to the Liberty runtime. installLiberty: Installs the Liberty runtime from a repository. libertyCreate: Creates a Liberty server. libertyDebug: Runs the Liberty server in the console foreground after a debugger connects to the debug port (default: 7777). libertyDev: Start a Liberty server in dev mode. libertyDevc: Start a Liberty server in dev mode in a container. libertyDump: Dumps diagnostic information from the Liberty server into an archive. libertyJavaDump: Dumps diagnostic information from the Liberty server JVM. libertyPackage: Packages a Liberty server. libertyRun: Runs a Liberty server in the Gradle foreground process. libertyStart: Starts the Liberty server in a background process. libertyStatus: Checks to see if the Liberty server is running. libertyStop: Stops the Liberty server. prepareFeature: Prepares a user feature for installation to the Liberty runtime. undeploy: Removes applications from the Liberty server. uninstallFeature: Remove a feature from the Liberty runtime. ``` -------------------------------- ### Apply Liberty Gradle Plugin (apply plugin) Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Groovy code snippet to apply the Liberty Gradle plugin using the 'apply plugin' syntax. ```Groovy apply plugin: 'liberty' ``` -------------------------------- ### Start Liberty Dev Mode Without Debugger (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty development mode without allowing a debugger to attach. This can be useful for performance testing or when debugging is not required. ```Shell $ gradle libertyDev --libertyDebug=false ``` -------------------------------- ### Start Liberty Dev Mode with Hot Tests (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty development mode and automatically runs tests after every code change. This is useful for continuous testing during development. ```Shell $ gradle libertyDev --hotTests ``` -------------------------------- ### Configure Open Liberty Server Applications with Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Defines how to configure applications (WAR/EAR) to be deployed to the Open Liberty server. It supports copying applications to the 'apps' or 'dropins' folders and can automatically deploy default applications if not explicitly configured. ```Gradle apps = [project.tasks.war] // List of war and ear task objects dropins = [project.tasks.ear] // List of war or ear objects ``` -------------------------------- ### Configure Server with User-Defined Files Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyCreate.md Configures the Liberty server by explicitly specifying user-defined files for server.xml, bootstrap.properties, jvm.options, and server.env. This allows for precise control over each configuration file, including renaming them to expected target names. ```groovy apply plugin: 'liberty' liberty { server { serverXmlFile = file('src/resources/config/server-test1.xml') bootstrapPropertiesFile = file('src/resources/config/bootstrap.test.properties') jvmOptionsFile = file('src/resources/config/jvm.test.options') serverEnvFile = file('src/resources/config/server.test.env') } } ``` -------------------------------- ### Start Liberty Dev Mode for Specific Project (Gradle) Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty development mode and specifies which project's Liberty configuration to use in a multi-project build. This is done by prefixing the task with the project's artifact ID. ```Shell $ gradle ear:libertyDev ``` -------------------------------- ### Configure Liberty Server User Directory Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Defines the value for the `${wlp_user_dir}` variable, which typically points to the Liberty server's user directory. The default is `${installDir}/usr/`. ```Gradle liberty { userDir = "/opt/IBM/Liberty/usr" } ``` -------------------------------- ### Gradle: Start dev mode with custom on-demand tests action Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyDev.md Starts the Liberty dev mode and changes the action for running on-demand tests. When `changeOnDemandTestsAction` is true, you can trigger tests by typing 't' and pressing Enter, instead of just pressing Enter. ```gradle $ gradle libertyDev --changeOnDemandTestsAction ``` ```groovy liberty { dev { changeOnDemandTestsAction=true } } ``` ```groovy ext { liberty.dev.changeOnDemandTestsAction=true } ``` -------------------------------- ### Control Loose Application Installation in Open Liberty with Gradle Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Specifies whether to install applications using loose application configuration, avoiding regeneration of WAR/EAR files for updates. Loose application support for EAR files requires Gradle 4.0 or higher. ```Gradle looseApplication = true // Install application using loose application configuration ``` -------------------------------- ### Spring Boot Support for Open Liberty Source: https://github.com/openliberty/ci.gradle/blob/main/README.md Enables the Liberty Gradle Plugin to support thinning and deploying Spring Boot applications onto an Open Liberty server, simplifying the integration of Spring Boot applications. ```Gradle Spring Boot Support ``` -------------------------------- ### Enable Gradle Debugging Source: https://github.com/openliberty/ci.gradle/wiki/Debug-Options This snippet shows how to enable debugging for Gradle builds. It starts a Gradle daemon in suspended mode, waiting for a debugger to attach on port 5005. ```bash gradle -Dorg.gradle.debug=true ``` -------------------------------- ### Override Default Liberty Runtime Artifact Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyExtensions.md Allows overriding the default `io.openliberty:openliberty-kernel` artifact used for installation. You can specify a different `group`, `name`, or `version` for the runtime. ```Gradle liberty { runtime { group = "com.example" name = "my-liberty-runtime" version = "21.0.0.10" } } ``` -------------------------------- ### Configure Server with configDirectory Source: https://github.com/openliberty/ci.gradle/blob/main/docs/libertyCreate.md Configures the Liberty server by specifying a directory containing server configuration files. This is useful for managing multiple configuration files like server.xml, bootstrap.properties, and included configurations. The default location for configDirectory is src/main/liberty/config. ```groovy apply plugin: 'liberty' liberty { server { configDirectory = file('src/resources/config') } } ```