Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix duplicities in the lite lib jar #3808

Merged
merged 13 commits into from
Oct 2, 2024
Merged
4 changes: 4 additions & 0 deletions api-catalog-services/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ spring:
client:
hostname: ${apiml.service.hostname}
ipAddress: ${apiml.service.ipAddress}
gateway:
mvc.enabled: false
enabled: false
mvc:
throw-exception-if-no-handler-found: true
output:
Expand All @@ -15,6 +18,7 @@ spring:
main:
allow-circular-references: true
banner-mode: ${apiml.banner:"off"}
web-application-type: servlet
profiles.group:
dev: debug, diag

Expand Down
22 changes: 20 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ buildscript {
}
}

import java.util.regex.Matcher

import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
import org.gradle.plugins.ide.eclipse.model.AccessRule
import org.gradle.plugins.ide.eclipse.model.ClasspathEntry
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry

import java.util.regex.Matcher

//noinspection GroovyAssignabilityCheck
group 'org.zowe.apiml'
Expand Down Expand Up @@ -95,6 +97,22 @@ allprojects {

}

configure(subprojects.findAll { it.name in [
'apiml-common-lib-package',
'api-catalog-services',
'caching-service',
'discovery-service',
'gateway-service',
'zaas-service'
]}) {

configurations.all {
// it has been replaced by spring-jcl
exclude group: "commons-logging", module: "commons-logging"
}

}

configure(subprojects.findAll {it.name != 'platform'}) {
apply plugin: 'java-library'

Expand Down
4 changes: 4 additions & 0 deletions caching-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ spring:
cloud:
compatibilityVerifier:
enabled: false # Should be removed when upgrade to Spring Cloud 3.x
gateway:
mvc.enabled: false
enabled: false
application:
name: Caching service
mvc:
Expand All @@ -119,6 +122,7 @@ spring:
main:
allow-circular-references: true
banner-mode: ${apiml.banner:"off"}
web-application-type: servlet

springdoc:
pathsToMatch: /api/v1/**
Expand Down
4 changes: 4 additions & 0 deletions discovery-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ spring:
client:
hostname: ${apiml.service.hostname}
ipAddress: ${apiml.service.ipAddress}
gateway:
mvc.enabled: false
enabled: false
output:
ansi:
enabled: detect
main:
banner-mode: ${apiml.banner:"off"}
allow-circular-references: true
web-application-type: servlet
profiles.group:
dev: debug, diag

Expand Down
26 changes: 23 additions & 3 deletions gateway-package/src/main/resources/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@

if [ -n "${LAUNCH_COMPONENT}" ]
then
JAR_FILE="${LAUNCH_COMPONENT}/gateway-service.jar"
JAR_FILE="${LAUNCH_COMPONENT}/gateway-service-lite.jar"
else
JAR_FILE="$(pwd)/bin/gateway-service.jar"
JAR_FILE="$(pwd)/bin/gateway-service-lite.jar"
fi
echo "jar file: "${JAR_FILE}
# script assumes it's in the gateway component directory and common_lib needs to be relative path

if [ -z "${CMMN_LB}" ]
pj892031 marked this conversation as resolved.
Show resolved Hide resolved
then
COMMON_LIB="../apiml-common-lib/bin/api-layer-lite-lib-all.jar"
else
COMMON_LIB=${CMMN_LB}
fi

if [ -z "${LIBRARY_PATH}" ]
then
LIBRARY_PATH="../common-java-lib/bin/"
Expand Down Expand Up @@ -122,6 +129,14 @@ else
nonStrictVerifySslCertificatesOfServices=false
fi

if [ "$(uname)" = "OS/390" ]
then
QUICK_START=-Xquickstart
GATEWAY_LOADER_PATH=${COMMON_LIB},/usr/include/java_classes/IRRRacf.jar
else
GATEWAY_LOADER_PATH=${COMMON_LIB}
pj892031 marked this conversation as resolved.
Show resolved Hide resolved
fi

ATTLS_ENABLED="false"
# ZWE_configs_spring_profiles_active for back compatibility, should be removed in v3 - enabling via Spring profile
if [ "${ZWE_zowe_network_server_tls_attls}" = "true" -o "$(echo ${ZWE_configs_spring_profiles_active:-} | awk '/^(.*,)?attls(,.*)?$/')" ]; then
Expand All @@ -148,7 +163,6 @@ else
externalProtocol="http"
fi

GATEWAY_LOADER_PATH=""
# Check if the directory containing the ZAAS shared JARs was set and append it to the ZAAS loader path
if [ -n "${ZWE_GATEWAY_SHARED_LIBS}" ]
then
Expand All @@ -167,6 +181,11 @@ LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390/default
LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390/j9vm
LIBPATH="$LIBPATH":"${LIBRARY_PATH}"

if [ -n "${ZWE_GATEWAY_LIBRARY_PATH}" ]
then
LIBPATH="$LIBPATH":"${ZWE_GATEWAY_LIBRARY_PATH}"
fi

ADD_OPENS="--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED
Expand Down Expand Up @@ -319,6 +338,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${GATEWAY_CODE} ${JAVA_BIN_DIR}java \
-Djdk.tls.client.cipherSuites=${client_ciphers} \
-Djava.protocol.handler.pkgs=com.ibm.crypto.provider \
-Djavax.net.debug=${ZWE_configs_sslDebug:-""} \
-Dloader.path=${GATEWAY_LOADER_PATH} \
-Djava.library.path=${LIBPATH} \
-Dloader.path=${GATEWAY_LOADER_PATH} \
-jar ${JAR_FILE} &
Expand Down
3 changes: 2 additions & 1 deletion gateway-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ normalization {
}

apply plugin: 'org.springframework.boot'
apply from: "$projectDir/gradle/lite.gradle"
apply plugin: 'com.google.cloud.tools.jib'
apply from: "../gradle/jib.gradle"

Expand Down Expand Up @@ -82,7 +83,7 @@ dependencies {

implementation libs.swagger2.parser
implementation libs.swagger3.parser
implementation libs.jaxbApi
implementation libs.bundles.jaxb

testImplementation libs.spring.boot.starter.test
testImplementation libs.spring.mock.mvc
Expand Down
64 changes: 64 additions & 0 deletions gateway-service/gradle/lite.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar

/**
* This gradle file extends task `build` to create thin JAR files:
* <baseName>-lite.jar - contains base SpringBoot part to be executable and built submodules
* <baseName>-lite-lib.jar - contains all external libraries (except modules)
*
* To run application with thin and library file use:
* java -Dloader.path=<baseName>-lite-lib-<version>.jar -jar <basename>-lite-<version>.jar
*
* Example:
* java -Dloader.path=zowe-rest-api-sample-spring-lite-lib-0.0.1-SNAPSHOT.jar -jar zowe-rest-api-sample-spring-lite-0.0.1-SNAPSHOT.jar
*/


buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath libs.spring.boot.gradle.plugin
}
}

apply from: "$rootDir/gradle/lite-project.gradle"

task liteJar(type: BootJar) {
//Do not allow duplicates by ignoring subsequent items to be created at the same path.
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
targetJavaVersion = JavaVersion.VERSION_17
manifest {
attributes 'Main-Class': 'org.springframework.boot.loader.launch.PropertiesLauncher'
}
def modulesJar = getModulesJarNames()
archiveFileName = getBaseNameLite() + ".jar"
mainClass = getSpringBootApp()
exclude { details -> details.file && details.file.name.endsWith('.jar') && !modulesJar.contains(details.file.name) }
with bootJar

archiveClassifier = "lite"
}

configurations {
liteJarConfiguration
}

artifacts {
liteJarConfiguration(liteJar) {
builtBy(liteJar)
}
}
task liteLibJar(type: Jar) {
archiveFileName = getBaseNameLite() + "-lib.jar"
entryCompression = ZipEntryCompression.STORED
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
include '*.jar'
exclude getModulesJarFilters()
with bootJar

archiveClassifier = "lite-lib"
}

jar.dependsOn liteLibJar
jar.dependsOn liteJar
1 change: 1 addition & 0 deletions gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ spring:
redirectUri: "{baseUrl}/gateway/{action}/oauth2/code/{registrationId}"
main:
banner-mode: ${apiml.banner:"off"}
web-application-type: reactive

springdoc:
api-docs:
Expand Down
1 change: 1 addition & 0 deletions gradle/lite.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ task liteLibJarAll(type: Jar) {
}

liteLibJarAll.dependsOn(":zaas-service:build")
liteLibJarAll.dependsOn(":gateway-service:build")
liteLibJarAll.dependsOn(":discovery-service:build")
liteLibJarAll.dependsOn(":api-catalog-services:build")

Expand Down
18 changes: 18 additions & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,27 @@ dependencyResolutionManagement {
version('springFramework', '6.1.13')
version('springRetry', '2.0.9')

version('glassfishHk2', '3.1.1')
version('zosUtils', '2.0.5')
version('aws', '1.12.772')
version('awaitility', '4.2.2')
version('bouncyCastle', '1.78.1')
version('caffeine', '3.1.8')
version('checkerQual', '3.43.0')
version('commonsLang3', '3.17.0')
version('commonsLogging', '1.3.4')
version('commonsText', '1.12.0')
version('commonsIo', '2.17.0')
version('ehCache', '3.10.8')
version('eureka', '2.0.3')
version('netflixServo', '0.13.2')
version('googleErrorprone', '2.32.0')
version('gradleGitProperties', '2.4.2') // Used in classpath dependencies
version('gradleNode', '3.6.0') // Used in classpath dependencies
version('guava', '33.3.1-jre')
// version('hamcrest', '1.3')
version('hamcrest', '2.2')
version('httpClient4', '4.5.14')
version('httpClient5', '5.4')
version('infinispan', '15.0.8.Final')
version('jacksonCore', '2.17.2')
Expand All @@ -39,6 +44,7 @@ dependencyResolutionManagement {
version('jakartaValidation', '3.1.0')
version('jakartaInject', '2.0.1')
version('jakartaServlet', '6.1.0')
version('javaxAnnotation', '1.3.2')
version('jaxbApi') {
strictly '[2.3.3,3.0.0['
prefer '2.3.3'
Expand All @@ -47,11 +53,13 @@ dependencyResolutionManagement {
strictly '[2.3.9,3.0.0['
prefer '2.3.9'
}
version('jbossLogging', '3.6.0.Final')
version('jerseySun', '1.19.4')
version('jettyWebSocketClient', '9.4.56.v20240826')
version('jettison', '1.5.4')
//0.12.x version contains breaking changes
version('jjwt', '0.12.6')
version('jodaTime', '2.12.7')
version('jsonPath', '2.9.0')
version('jsonSmart', '2.5.1')
version('junitJupiter', '5.11.0')
Expand Down Expand Up @@ -133,20 +141,27 @@ dependencyResolutionManagement {
library('spring_beans', 'org.springframework', 'spring-beans').versionRef('springFramework')

library('apache_commons_lang3', 'org.apache.commons', 'commons-lang3').versionRef('commonsLang3')
library('apache_commons_logging', 'commons-logging', 'commons-logging').versionRef('commonsLogging') // to define minimum version and avoid duplicity libraries in the classpath
library('apache_commons_text', 'org.apache.commons', 'commons-text').versionRef('commonsText')

library('aopalliance', 'org.glassfish.hk2.external', 'aopalliance-repackaged').versionRef('glassfishHk2') // to define minimum version and avoid duplicity libraries in the classpath
library('hk2_api', 'org.glassfish.hk2', 'hk2-api').versionRef('glassfishHk2') // to define minimum version and avoid duplicity libraries in the classpath
library('apache_velocity', 'org.apache.velocity', 'velocity-engine-core').versionRef('velocity')
library('awaitility', 'org.awaitility', 'awaitility').versionRef('awaitility')
library('aws_bom', 'com.amazonaws', 'aws-java-sdk-bom').versionRef('aws')
library('bcprov', 'org.bouncycastle', 'bcprov-jdk18on').versionRef('bouncyCastle')
library('bcpkix', 'org.bouncycastle', 'bcpkix-jdk18on').versionRef('bouncyCastle')
library('caffeine', 'com.github.ben-manes.caffeine', 'caffeine').versionRef('caffeine')
library('checker_qual', 'org.checkerframework', 'checker-qual').versionRef('checkerQual')
library('commons_io', 'commons-io', 'commons-io').versionRef('commonsIo')
library('eh_cache', 'org.ehcache', 'ehcache').versionRef('ehCache')
library('eureka_jersey_client', 'com.netflix.eureka', 'eureka-client-jersey3').versionRef('eureka')
library('google_errorprone', 'com.google.errorprone', 'error_prone_annotations').versionRef('googleErrorprone') // to define minimum version and avoid duplicity libraries in the classpath
library('guava', 'com.google.guava', 'guava').versionRef('guava')
library('hamcrest', 'org.hamcrest', 'hamcrest').versionRef('hamcrest')
library('http_client4', 'org.apache.httpcomponents', 'httpclient').versionRef('httpClient4') // to define minimum version and avoid duplicity libraries in the classpath
library('http_client5', 'org.apache.httpcomponents.client5', 'httpclient5').versionRef('httpClient5')
library('javax_annotation', 'javax.annotation', 'javax.annotation-api').versionRef('javaxAnnotation') // to define minimum version and avoid duplicity libraries in the classpath
library('netflix_servo', 'com.netflix.servo', 'servo-core').versionRef('netflixServo')

library('infinispan_spring_boot3_starter_embedded', 'org.infinispan', 'infinispan-spring-boot3-starter-embedded').versionRef('infinispan')
Expand All @@ -162,6 +177,7 @@ dependencyResolutionManagement {
library('jakarta_servlet_api', 'jakarta.servlet', 'jakarta.servlet-api').versionRef('jakartaServlet')
library('jaxbApi', 'jakarta.xml.bind', 'jakarta.xml.bind-api').versionRef('jaxbApi')
library('jaxbImpl', 'com.sun.xml.bind', 'jaxb-impl').versionRef('jaxbImpl')
library('jboss_logging', 'org.jboss.logging', 'jboss-logging').versionRef('jbossLogging') // to define minimum version and avoid duplicity libraries in the classpath
library('jetty_client', 'org.eclipse.jetty', 'jetty-client').versionRef('jettyWebSocketClient')
library('jetty_http', 'org.eclipse.jetty', 'jetty-http').versionRef('jettyWebSocketClient')
library('jetty_io', 'org.eclipse.jetty', 'jetty-io').versionRef('jettyWebSocketClient')
Expand All @@ -170,6 +186,7 @@ dependencyResolutionManagement {
library('jetty_websocket_client', 'org.eclipse.jetty.websocket', 'websocket-client').versionRef('jettyWebSocketClient')
library('jetty_websocket_common', 'org.eclipse.jetty.websocket', 'websocket-common').versionRef('jettyWebSocketClient')
library('jettison', 'org.codehaus.jettison', 'jettison').versionRef('jettison')
library('joda_time', 'joda-time', 'joda-time').versionRef('jodaTime') // to define minimum version and avoid duplicity libraries in the classpath
library('json_smart', 'net.minidev', 'json-smart').versionRef('jsonSmart')
library('jjwt', 'io.jsonwebtoken', 'jjwt-api').versionRef('jjwt')
library('jjwt_impl', 'io.jsonwebtoken', 'jjwt-impl').versionRef('jjwt')
Expand Down Expand Up @@ -222,6 +239,7 @@ dependencyResolutionManagement {
library('gradle_jib_plugin', 'gradle.plugin.com.google.cloud.tools', 'jib-gradle-plugin').versionRef('gradleJibPlugin')
library('gradle_test_logger', 'com.adarshr', 'gradle-test-logger-plugin').versionRef('gradleTestLogger')
library('micronaut_http_client', 'io.micronaut', 'micronaut-http-client').versionRef('micronaut')
library('micronaut_bom', 'io.micronaut', 'micronaut-core-bom').versionRef('micronaut')
library('apache_compress', 'org.apache.commons', 'commons-compress').versionRef('commonsCompress')

plugin('gradle_git_properties', 'com.gorylenko.gradle-git-properties').versionRef('gradleGitProperties')
Expand Down
1 change: 1 addition & 0 deletions platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
api(platform(libs.spring.boot.dependencies))
api(platform(libs.netty.bom))
api(platform(libs.aws.bom))
api(platform(libs.micronaut.bom))

constraints {
// to define preferred version (the minimal version constraints)
Expand Down
5 changes: 4 additions & 1 deletion zaas-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dependencies {
implementation libs.jackson.annotations
implementation libs.jackson.core
implementation libs.jackson.databind
implementation libs.jaxbApi
implementation libs.spring.cloud.commons
implementation libs.jjwt
implementation libs.nimbus.jose.jwt
Expand All @@ -86,7 +87,9 @@ dependencies {
implementation libs.spring.webmvc
implementation libs.spring.webflux

implementation libs.eh.cache
implementation(libs.eh.cache) {
exclude group: "jakarta.xml.bind", module: "jakarta.xml.bind-api"
}

implementation libs.bundles.jaxb

Expand Down
Loading
Loading