ci.gradle
ci.gradle copied to clipboard
Multi module Gradle application failed to deploy into liberty server
I am trying to deploy multi module Gradle application into Liberty server and it is failing to deploy into apps folder. I followed this documentation and I could not deploy into liberty server.
apply plugin: 'liberty'
dependencies {
libertyApp 'example:app:1.0'
}
I tried both looseApplication=false and true options and it did not work. Here is my gradle.build file below.
apply plugin: 'liberty'
buildscript {
repositories {
mavenCentral()
maven {
name = 'Sonatype Nexus Snapshots'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.3.1'
}
}
description = 'GarageSaleRuntime'
def libertyInstallDir = "C:\\MyData\\LibertyInstalls\\wlp"
dependencies {
libertyApp project(':GarageSaleLibertyEAR')
libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-jakartaee9', version: '22.0.0.5'
}
liberty {
installDir="${libertyInstallDir}"
server {
name = "garageSaleServer"
serverXmlFile = file('publish/servers/server.xml')
jvmOptionsFile = file('publish/files/jvm.options')
configDirectory = file('publish/config')
looseApplication = false
stripVersion = true
stripVersion = true
features {
name = ["${projectDir}/publish/files/WASPersonaWebServicesHandlerFeature_1.0.0.202110181027.esa"]
acceptLicense = true
}
}
}
task copyDB2Jars(type: Copy) {
from 'publish/databaseDrivers/db2V9Drivers'
into "${buildDir}/wlp/usr/shared/resources/db2drivers"
}
task copyJaxRSThirdPartyJars(type: Copy) {
from 'publish/jaxrsThirdPartyJars'
into "${buildDir}/wlp/usr/shared/resources/jaxrsThirdPartyJars"
}
task copyMyEAR(type: Copy) {
from '../GarageSaleLibertyEAR/build/libs/GarageSaleLibertyEAR.ear'
into "${buildDir}/wlp/usr/servers/garageSaleServer/apps"
}
//libertyCreate.finalizedBy 'copyMyEAR', 'copyDB2Jars', 'copyJaxRSThirdPartyJars'
libertyCreate.finalizedBy 'copyDB2Jars', 'copyJaxRSThirdPartyJars'
build.dependsOn 'deploy'
I did some testing with this project and it seems that there were a couple more pieces needed to get the ear file deployed.
- Specifying the configuration to use for the
libertyApp
dependency ->libertyApp project(path: ':GarageSaleLibertyEAR', configuration: 'archives')
- Binding the
ear
task fromGarageSaleLibertyEAR
todeploy
->deploy.dependsOn ':GarageSaleLibertyEAR:ear'
@jagraj Is this resolved? Can we close the issue?
@cherylking I got the application deployed with the above changes recommended by Matt. I would like to verify looseApplication=true scenario with multi module projects and this is not working. I was able to verify with liberty maven plugin but I am not able to get it working with Gradle plugin.
@jagraj Multi module support has not been added to the Gradle plugin for dev mode. Issue #625 is open for that. But your scenario does not involve dev mode correct?
@cherylking
Yes, my scenario is not involved with dev mode. My application was working fine with old version of liberty plugin liberty-gradle-plugin:2.1.1-SNAPSHOT
and the same app fails to deploy with the latest version of gradle plugin liberty-gradle-plugin:3.3.1
after migrating my application for Jakarta EE9 development.
@jagraj We have made some fixes around loose application deployment in recent releases. Would you mind trying our most recent 3.6 version of the plugin and see if it resolves the problem you were seeing?
@cherylking Sure, I will rerun my scenario early next week and get back to you. I have been working on other releases this week. Thanks for the fixes.