Hi Michael, I could be mistaken, but I think perhaps you're trying to remove the dependency during the execution phase instead of the configuration phase?
Would a patch like the below not work? diff --git a/build.gradle b/build.gradle index e5bfb3e9c9..96dcb53a01 100644 --- a/build.gradle +++ b/build.gradle @@ -976,11 +976,14 @@ tasks.addRule('Pattern: ofbizBackground <Commands>: Execute OFBiz startup comman * ======================================================== */ def createOfbizCommandTask(taskName, arguments) { - task(type: JavaExec, dependsOn: classes, taskName) { + task(taskName, type: JavaExec) { jvmArgs(application.applicationDefaultJvmArgs) classpath = sourceSets.main.runtimeClasspath main = application.mainClassName args arguments + if (!(taskName ==~ /^ofbiz.*(--shutdown|-d).*/)) { + dependsOn classes + } if (taskName ==~ /^ofbiz.*(--test|-t).*/) { finalizedBy(createTestReports) } On Tue, Feb 25, 2020 at 8:48 PM Michael Brohl <michael.br...@ecomify.de> wrote: > > Hi Taher, > > thanks for your feedback! > > It seems that removing a dependency from a task is deprecated and should > not be used: > > "Do not remove a task dependency from a Task instance. This behaviour > has been deprecated and is scheduled to be removed in Gradle 6.0." > > Given this depracation, do you think there is another way to reduce the > code added? > > Thanks! > > > Am 25.02.20 um 12:14 schrieb Taher Alkhateeb: > > Hi Michael, > > > > The idea is fine but I think we can improve the implementation. All that > > you need is to remove the dependsOn declaration if it is a shutdown command > > which would probably result in less code than in the proposed patch. > > > > Cheers > > > > On Tue, Feb 25, 2020, 1:32 PM Michael Brohl <michael.br...@ecomify.de> > > wrote: > > > >> Oops, just realized I already asked in > >> > >> https://lists.apache.org/thread.html/rf88ce5eb1a3842471ddb8239bb5f08b71c107c4b0d3863b3c13e54fe%40%3Cdev.ofbiz.apache.org%3E > >> > >> Better respond there, thanks! > >> > >> Michael > >> > >> > >> Am 25.02.20 um 11:29 schrieb Michael Brohl: > >>> Hi devs, > >>> > >>> any objections to get this into the codebase (and backporting to > >>> 17.12./18.12)? > >>> > >>> See https://issues.apache.org/jira/browse/OFBIZ-10168 > >>> > >>> Thanks for your feedback, > >>> > >>> Michael Brohl > >>> > >>> ecomify GmbH - www.ecomify.de > >>> > >>> > >>> > >> >