SAP / commerce-gradle-plugin

Gradle plugins for the full development lifecycle of a SAP Commerce project
Apache License 2.0
33 stars 12 forks source link

HybrisAntTask xPath error in new SAP commerce version 2205 #39

Closed tklostermannNSD closed 2 years ago

tklostermannNSD commented 2 years ago

The hybris ant task throws the error java.lang.IllegalAccessError: class com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15 (in unnamed module @0x67f946c3) cannot access class com.sun.org.apache.xpath.internal.XPathAPI (in module java.xml) because module java.xml does not export com.sun.org.apache.xpath.internal to unnamed module @0x67f946c3 when trying to install addons with the new version 2205. In fact every ant task that uses the "xmltask" task gets this error. When trying to install the addon the old way with ". ./setantenv.sh" and "ant addoninstall" command everything works.

These are the added ANT_OPTS in setantenv.sh: -Dpolyglot.js.nashorn-compat=true -Dpolyglot.engine.WarnInterpreterOnly=false \ --add-exports java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED \ --add-exports java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED

tklostermannNSD commented 2 years ago

I see that ant gets called with these arguments. Then its probably the Java version used for the addoninstall task. This might get fixed by editing the build.gradle with this: java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 }

tklostermannNSD commented 2 years ago

See https://github.com/SAP/commerce-gradle-plugin/pull/40

mpern commented 2 years ago

Thanks for reporting!

The plugin calls ant as an external java executable via Gradle's JavaExec

For 2205, we need to translate the new ANT_OPTS of setantenv.sh to jvmArgs, systemProperties or args as required

edit Note to self: https://stackoverflow.com/questions/65225327/how-do-i-properly-add-add-opens-to-jvmargs-in-javaexec-task

mpern commented 2 years ago

Fixed in v3.7.0