From notifications-return-31209-apmail-ofbiz-notifications-archive=ofbiz.apache.org@ofbiz.apache.org Sat Feb 22 11:33:02 2020 Return-Path: X-Original-To: apmail-ofbiz-notifications-archive@minotaur.apache.org Delivered-To: apmail-ofbiz-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id 24953190AC for ; Sat, 22 Feb 2020 11:33:02 +0000 (UTC) Received: (qmail 22400 invoked by uid 500); 22 Feb 2020 11:33:01 -0000 Delivered-To: apmail-ofbiz-notifications-archive@ofbiz.apache.org Received: (qmail 22383 invoked by uid 500); 22 Feb 2020 11:33:01 -0000 Mailing-List: contact notifications-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list notifications@ofbiz.apache.org Received: (qmail 22372 invoked by uid 99); 22 Feb 2020 11:33:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Feb 2020 11:33:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 94FE6E29AA for ; Sat, 22 Feb 2020 11:33:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 0FA58780445 for ; Sat, 22 Feb 2020 11:33:00 +0000 (UTC) Date: Sat, 22 Feb 2020 11:33:00 +0000 (UTC) From: "Michael Brohl (Jira)" To: notifications@ofbiz.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OFBIZ-10168) Allow shutdown in Gradle without building the project MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OFBIZ-10168?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Brohl updated OFBIZ-10168: ---------------------------------- Sprint: OFBiz Community Day (Feb 2020) > Allow shutdown in Gradle without building the project > ----------------------------------------------------- > > Key: OFBIZ-10168 > URL: https://issues.apache.org/jira/browse/OFBIZ-10168 > Project: OFBiz > Issue Type: Improvement > Components: Gradle > Affects Versions: Trunk > Reporter: Karsten Tymann > Assignee: Michael Brohl > Priority: Minor > Attachments: OFBIZ-10168_shutdown_without_build.patch, OFBIZ-1016= 8_shutdown_without_build.patch > > > *Allow to shutdown OFBiz server in Gradle without rebuilding the project* > This patch for the build.gradle allows to shutdown a running OFBiz instan= ce without > rebuilding the Java project. It allows for the shorter command > {code:java} > ./gradlew ofbizShutdown{code} > as well as for the already known command > {code:java} > ./gradlew "ofbiz --shutdown".{code} > Therefore there are no changes on the already known script calls with the= addition > of the new shorter way "ofbizShutdown". > "ofbizShutdown" can also be called with the portoffset parameter, passed = via > {code:java} > ./gradlew ofbizShutdown -Pportoffset=3D5000{code} > More information later. > The reason for the patch is that a rebuilding of the project just for shu= tting the running instance down serves no purpose. > In order to run ofbiz in the background it is already compiled and there= fore usable > for shutting it down. > Additionally it also makes sense to be able to shutdown ofbiz even if th= e current > changes are not compiling. Thus the shutdown does not depend on a compil= ing project. > Furthermore I have changed the task definition in the method *createOfbiz= CommandTask* > since it contains a very confusing syntax. For less experienced users on= e might > think that the task dependsOn the build as well as the input *taskName-t= ask*. > I changed it so that the task name is the first parameter so that it bec= omes > more clear how the task is called and on what it depends. > =C2=A0 > -------------------------------------------------------------------------= ----------------------------------- > Aside from the patch I want to suggest changes on the passing of the argu= ments for > future development: The passing of arguments such as "--help" or "--shut= down" is not the > intended way of using gradle, atleast not in the form we are doing it. > In my opinion there are 3 accepted Gradle ways of passing arguments: > 1. via -D -> sets a system property of the JVM > 2. via -P -> sets a project property > 3. via writing custom tasks that implement the @Option annotation, > enabling to pass arguments in the "--option=3Dvalue" syntax > While I can see that *1.* and *2.* can be tedious to implement the readin= g of potential arguments, I still consider it as important to implement it = in either way. > OFBiz should not be unique in the sense of executing Gradle scripts and = passing parameters > so the work depends on us to be as close to the Gradle-Style as possible= . Technically > it is easy to do, again, its just a little tedious. > Another possibility would be to implement *3.* since it is similar to wh= at we want to achieve. > The command line options can be implemented in Gradle although it is an = internal feature. > This means that the feature is not intended for the public, although it = is considered to be > made for public use since 2013 by the Gradle developers. > It allows for a great syntax of passing options to the execution of a si= ngle task: > {code:java} > ./gradlew exampleTask --optionName optionvalue{code} > We can achieve such a syntax by defining a custom task: > {code:java} > import org.gradle.api.internal.tasks.options.Option > task exampleTask(type: exampleTask) > class exampleTask extends DefaultTask { > =C2=A0=C2=A0=C2=A0 @Option(option =3D "optionName", > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 descri= ption =3D "Pass a parameter", > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 order = =3D 1) > =C2=A0=C2=A0=C2=A0 Object optionName > =C2=A0=C2=A0=C2=A0 @TaskAction > =C2=A0=C2=A0=C2=A0 void do() { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 println optionName > =C2=A0=C2=A0=C2=A0 } > } > {code} > Ultimately this is the way one would wish to pass task specific options. = Since > Gradle is using it internal, I would consider to use it as well. -- This message was sent by Atlassian Jira (v8.3.4#803005)