cancel
Showing results for 
Search instead for 
Did you mean: 

Applying a custom patch using --patch-module to a java spring boot multi-target application

bathejasumeet
Explorer
0 Kudos

Hi All, we are currently trying to patch a java file in the module java.base in a spring boot mta application that we are deploying to btp using cf. The patch seems to be working fine on the local - both via

  • the java command executed like this on the generated file " java --patch-module=java.base=patch.jar -jar common-replication-service-application-run.jar "
  • and also by including it in pom.xml using "jvmArguments : --patch-module=java.base=patch.jar" and then "executing mvn spring-boot:run"

But when we use mbt build and cf deploy with the patch applied (specifying the regex build-result: "target/*.[wj]ar" to include all jars), the application fails to deploy on cf giving error

 java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.application.name' in value "${spring.application.name}" .

Has anyone patched the java classes before on cf? if so - can someone please advise ?
An excerpt from our mta.yaml

- name: common-replication-srv-custom-2
  type: java
  path: application
  properties:
    SPRING_PROFILES_ACTIVE: cloud
    JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'
    JBP_CONFIG_COMPONENTS: "{jres: ['com.sap.xs.java.buildpack.jdk.SAPMachineJDK']}"
    JBP_CONFIG_OPEN_JDK_JRE: "{ jre: { version: 11.+ }}"
    SET_LOGGING_LEVEL: '{ROOT: INFO, com.sap.cloud.sdk: INFO}'
    JBP_CONFIG_SAPJVM_MEMORY_SIZES: 'metaspace:128m..'
    JBP_CONFIG_JAVA_OPTS: "[java_opts: '-Xshare:off  --patch-module=java.base=patch.jar']"
  build-parameters:
    builder: custom
    ignore: [ "*.md" ]
    commands:
      - mvn -B -f ../pom.xml clean install -DskipTests=true
    build-result: "target/*.[wj]ar"

Accepted Solutions (0)

Answers (0)