Skip to content
Gradle plugins for managing Liberty profile servers #devops
Branch: master
Clone or download
anjumfatima90 and chyt Add support for Spring Boot JAR and WAR with classifier (#308)
* Test Spring Boot JAR and WAR with classifier

* Add support for Spring Boot JAR and WAR with classifier

* Update the build files to support different Gradle versions for Spring Boot Applications

* Update ci.common version to 1.3.6-SNAPSHOT

* Refactor to remove the method getBaseName()

* Replace "/" with File.separator

* Added multiple test filter
Latest commit 370a761 Mar 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Adding libertyApplication configuration to pull in application artifa… Feb 15, 2019
gradle/wrapper Updating plugin to run on Gradle 5.x (#292) Jan 7, 2019
src Add support for Spring Boot JAR and WAR with classifier (#308) Mar 26, 2019
.codacy.yml Updated to 2.2-SNAPSHOT, Arquillian Liberty CR1 artifacts, badges Feb 21, 2018
.gitignore Loose Application for Ear Support (#202) Feb 1, 2018
.travis.yml Add support for Spring Boot JAR and WAR with classifier (#308) Mar 26, 2019
CONTRIBUTING.md Update CONTRIBUTING.md Sep 12, 2014
LICENSE Initial version May 1, 2014
README.md Test 19.0.0.2 (#297) Mar 8, 2019
appveyor.yml
build.gradle Add support for Spring Boot JAR and WAR with classifier (#308) Mar 26, 2019
gradle-test.sh Add support for Spring Boot JAR and WAR with classifier (#308) Mar 26, 2019
gradlew Updating plugin to run on Gradle 5.x (#292) Jan 7, 2019
gradlew.bat Updating plugin to run on Gradle 5.x (#292) Jan 7, 2019

README.md

ci.gradle Maven Central Latest Build Status Build status Codacy Badge

The Liberty Gradle plugin supports install and operational control of Liberty runtime and servers. Use it to manage your application on Liberty for integration test and to create Liberty server packages.

Build

Clone this repository and then, with a JRE on the path, execute the following command in the root directory.

$ ./gradlew build

This will download Gradle, build the plugin, and install it in to the build\libs directory. It is also possible to install the plugin in to your local Maven repository using ./gradlew install.

To build the plugin and run the integration tests execute the following commands in the root directory. The runtime and runtimeVersion parameters are used to select the Liberty runtime that will be used to run the tests. The wlpLicense parameter is only needed for Liberty packaged as a JAR file.

$ ./gradlew install check -Druntime=<wlp|ol> -DruntimeVersion=<runtime_version> -DwlpLicense=<liberty_license_code>

Usage

Adding the plugin to the build script

Within your Gradle build script, you need to set up the classpath to include the Liberty Gradle plugin. You also need to define the Maven Central repository to find the plugin and its dependencies.

If you are using a snapshot version of the plugin make sure to define the Sonatype Nexus Snapshots repository in addition to the Maven Central repository.

Your build script should look like this:

buildscript {
    repositories {
        mavenCentral()
        maven {
            name = 'Sonatype Nexus Snapshots'
            url = 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
    dependencies {
        classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.1.1-SNAPSHOT'
    }
}

To use the Liberty Gradle Plugin, include the following code in your build script:

apply plugin: 'liberty'

Plugin Configuration

See the Liberty extension properties reference for the properties used to configure the Liberty plugin. See each task for additional configuration and examples.

Tasks

The Liberty plugin provides the following tasks for your project:

Task Description
cleanDirs Cleans the Liberty server logs, workarea, and applications folders.
installLiberty Installs the Liberty runtime from a repository.
libertyCreate Creates a Liberty server.
installFeature Installs an additional feature to the Liberty runtime.
uninstallFeature Remove a feature from the Liberty runtime.
installApps Copy applications generated by the Gradle project to a Liberty server's dropins or apps directory. The server can be stopped or started for this task.
libertyStart Starts the Liberty server in a background process.
libertyStop Stops the Liberty server.
libertyRun Runs a Liberty server in the Gradle foreground process.
libertyPackage Packages a Liberty server.
libertyDump Dumps diagnostic information from the Liberty server into an archive.
libertyJavaDump Dumps diagnostic information from the Liberty server JVM.
libertyDebug Runs the Liberty server in the console foreground after a debugger connects to the debug port (default: 7777).
libertyStatus Checks to see if the Liberty server is running.
deploy Deploys a supported file to a running Liberty server.
undeploy Removes an application from the Liberty server.
compileJsp Compiles the JSP files from the src/main/webapp directory into the build/classes directory.

Task ordering

The Liberty Gradle plugin defines a built-in task order to allow a user to call an end task without worrying about calling the necessary tasks in between. By having the plugin manage tasks and their order of execution we can easily avoid some simple human errors. For example, in order to have a majority of the tasks function, the principal task installLiberty must be called, which our plugin would do for you.

The most appealing benefit from defining a task order is the ability to allow the user to call an end task directly. For example, if the user calls libertyStart out of the box, Gradle will recognize that it must call installLiberty -> libertyCreate -> installFeature -> installApps to get a server with features and apps properly running.

Click on a task to view what it depends on.

Extensions

Extensions are tasks that improve the compatibility or user experience of third party libraries used with Liberty. The liberty-gradle-plugin provides the following extensions:

Extension Description
configureArquillian Integrates arquillian.xml configuration for the Liberty Managed and Remote Arquillian containers in the liberty-gradle-plugin. Automatically configures required arquillian.xml parameters for the Liberty Managed container.
You can’t perform that action at this time.