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.setMain() fails for yclean #59

Closed alanktwong closed 1 year ago

alanktwong commented 1 year ago

I am trying to use your plugin to setup Commerce 2211 using Gradle 8.2.1 and Java 17

I noticed this failed

  • What went wrong: Execution failed for task ':yclean'. Failed to notify task execution listener. 'org.gradle.api.tasks.JavaExec mpern.sap.commerce.build.tasks.HybrisAntTask.setMain(java.lang.String)'

And that's due to the fact that Gradle is migrating many tasks over to Property<String>. Specifically getMainClass().set(string) should be used instead.

https://docs.gradle.org/8.2.1/javadoc/org/gradle/process/JavaExecSpec.html#setMain-java.lang.String-

More precisely, we're using SAP's Gradle plugin and extending it to support the functionality that we want for our proprietary plugin.

mpern commented 1 year ago

Hi Alan!

I cannot reproduce the issue using a sample test project. Are you configuring/modifying the yclean task in your build somehow?

alanktwong commented 1 year ago

@mpern , No problems. I found the root cause, which was I had a buildSrc/build.gradle trying to download an older version of the plugin that was using JavaExecSpec.setMain(...), when my build.gradle was using the newer version.

So if others run into the issue the solution is simple:

alanktwong commented 1 year ago

This issue can be closed.

mpern commented 1 year ago

https://docs.gradle.org/current/userguide/custom_plugins.html#applying_external_plugins_in_precompiled_script_plugins